public IEnumerator decideState(float h, float v) { //Aiming if (Input.GetKey(KeyCode.Mouse1) && isGrounded) { soundValue = 45; aiming = true; } else if (Input.GetKeyUp(KeyCode.Mouse1) && isGrounded) { aiming = false; } //Shooting if (Input.GetMouseButton(0) && aiming) { soundValue = 125; attacking = true; } else if (Input.GetMouseButtonUp(0)) { attacking = false; shootingRef.SendMessage("PullTrigger", attacking); } //Running if (Input.GetKey(KeyCode.LeftShift) && isGrounded && !aiming) { running = true; walking = false; soundValue = 80; rotateSpeed = 2.0f; } else if (Input.GetKeyUp(KeyCode.LeftShift)) { running = false; } //Dodging if (Input.GetKeyDown(KeyCode.Space) && isGrounded && animComplete) { dodging = true; rotateSpeed = 1.0f; soundValue = 80; animComplete = false; yield return(StartCoroutine(Animating(h, v))); } if (Input.GetKeyUp(KeyCode.Space) && isGrounded && animComplete) { dodging = false; } else if (animComplete) { dodging = false; } // Walking if ((Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D)) && !(h == 0 && v == 0) && isGrounded && !running && !dodging) { walking = true; soundValue = 50; rotateSpeed = 7.0f; } else { walking = false; } //Knock back attack (kicking) if (Input.GetKeyDown(KeyCode.F) && isGrounded && animComplete) { knockback = true; animComplete = false; soundValue = 80; yield return(StartCoroutine(Animating(h, v))); } else if (Input.GetKeyUp(KeyCode.F) && animComplete) { knockback = false; yield return(StartCoroutine(Animating(h, v))); } //Interacting if (Input.GetKeyDown(KeyCode.E) && isGrounded && animComplete) { interacting = true; soundValue = 30; animComplete = false; yield return(StartCoroutine(Animating(h, v))); if (animComplete) { NotificationsManager.DefaultNotifier.PostNotification(this, "OnPlayerInteract"); } } else if (Input.GetKeyUp(KeyCode.E) && animComplete) { interacting = false; yield return(StartCoroutine(Animating(h, v))); } if (!Input.anyKeyDown) { idle = true; soundValue = 0f; } else { idle = false; } yield return(StartCoroutine(Animating(h, v))); }