cwisbg

AnimatorTestor

Feb 26th, 2017
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class skierAnimatorScript : MonoBehaviour {
  5.  
  6.     static Animator animator;
  7.  
  8.  
  9.     void Start () {
  10.  
  11.         animator = GetComponent<Animator>();
  12.  
  13.     }
  14.     void Update () {
  15.         if (Input.GetKeyUp ("w")) {
  16.             animator.SetBool("IsJump", true);
  17.         }
  18.  
  19.         if (Input.GetKeyUp ("s")) {
  20.             animator.SetBool ("IsJump", false);
  21.         }
  22.  
  23.         if (Input.GetKey ("a")) {
  24.             animator.SetBool("IsLeft", true);
  25.             //animator.SetBool("IsIdle", true);
  26.         }
  27.  
  28.         if (Input.GetKey ("d")) {
  29.             animator.SetBool ("IsRight", true);
  30.             //animator.SetBool("IsIdle", true);
  31.         }
  32.         else{
  33.             animator.SetBool("IsIdle", true);
  34.             animator.SetBool("IsLeft", false);
  35.             animator.SetBool ("IsRight", false);
  36.  
  37.  
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment