Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Farter : StateMonoBehaviour
- {
- void Start()
- {
- SetState(Normal);
- }
- IEnumerator Normal()
- {
- while (true)
- {
- if (Input.GetKeyDown(KeyCode.F))
- SetState(Fart);
- yield return null;
- }
- }
- IEnumerator Fart()
- {
- Debug.Log("now farting!");
- // play some animation or something
- // wait a second
- yield return new WaitForSeconds(1f);
- // go back to normal state
- SetState(Normal);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment