Boat Attack使用了Universal RP的许多新图形功能,可以用于探索 Universal RP 的使用方式和技巧。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

55 行
1.1 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Playables;
public class GunController : MonoBehaviour
{
public InputAction fireAction;
public GameObject gun;
private PlayableDirector gunDirector;
// Start is called before the first frame update
void Start()
{
InitGuns();
// Have it run your code when the Action is triggered.
fireAction.performed += FireGuns;
// Start listening for control changes.
fireAction.Enable();
}
// Update is called once per frame
void Update()
{
// if (Input.GetAxis("fire") > 1)
// {
// DeployGuns();
// }
}
void InitGuns()
{
gunDirector = gun.GetComponent<PlayableDirector>();
gunDirector.time = 0f;
gunDirector.Stop();
Debug.LogFormat("InitGuns {0}", gunDirector.time);
}
void DeployGuns()
{
gunDirector.Play();
}
void FireGuns(InputAction.CallbackContext ctx)
{
Debug.Log("FIRE!!!!");
gunDirector.Play();
}
}