实现jump trigger:
声明jump玩家键入控制角色
思路:jump与last jump是否不一样 如果不一样玩家则按下jump指令,否则没有按 .
代码实现:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerInput : MonoBehaviour
{
[Header("==== Key settings ====")]
public string keyUp = "w";
public string keyDown = "s";
public string keyLeft = "a";
public string keyRight = "d";
public string keyA;
public string keyB;
public string keyC;
public string keyD;
[Header("==== Output signal ====")]
public float Dup;
public float Dright;
public float Dmag;
public Vector3 Dvec;
//1.pressing signal 按压式
public bool run;
//2.trigger once signal 一次性触发
public bool jump;//按后发
private bool lastjump;//判断是否按 和jump一样就是没按 如果不一样就是按了
//3.double trigger
[Heade