private void Update() { float x = Input.GetAxisRaw("Horizontal"); if (x == 0) { animator.SetBool("isWalked", false); } else { animator.SetBool("isWalked", true); } movement2D.Move(x); if (Input.GetKeyDown(KeyCode.Space)) { animator.SetBool("isJumped", true); movement2D.Jump(); } if (Input.GetKey(KeyCode.Space)) { movement2D.isLongJump = true; } else if (Input.GetKeyUp(KeyCode.Space)) { animator.SetBool("isJumped", false); movement2D.isLongJump = false; } }
// Start is called before the first frame update void Start() { b = GameObject.Find("MainButton").GetComponent <Button>(); GO = GameObject.Find("GoldDonkey"); PM = GO.GetComponent <Player_Move>(); b.onClick.AddListener(() => PM.Jump()); b.onClick.AddListener(Test); }