Advertisement
goeddeninfo

movePlayer

Nov 2nd, 2020
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class movePlayer : MonoBehaviour
  6. {
  7.     // Start is called before the first frame update
  8.     void Start()
  9.     {
  10.         anim = GetComponent<Animator>();
  11.     }
  12.  
  13.     // Update is called once per frame
  14.     void Update()
  15.     {        
  16.         if (Input.GetKeyDown("right"))
  17.         {
  18.             if (anim != null)
  19.             {
  20.                 anim.ResetTrigger("Idle");
  21.                 anim.SetTrigger("Activ");
  22.  
  23.             }
  24.         }
  25.         if (Input.GetKeyUp("right"))
  26.         {
  27.             if (anim != null)
  28.             {
  29.                 anim.ResetTrigger("Activ");
  30.                 anim.SetTrigger("Idle");
  31.  
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement