This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CameraShake () { | |
var hitTime = Time.time; | |
var originalPosition = cam.transform.localPosition.x; | |
var shakeCounter = numberOfShakes; | |
var shakeDistance = startingShakeDistance; | |
while (shakeCounter > 0) { | |
// Make timers always start at 0 | |
var timer = (Time.time - hitTime) * shakeSpeed; | |
cam.transform.localPosition.x = originalPosition + Mathf.Sin(timer) * shakeDistance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections.Generic; | |
public class SimpleFSM : MonoBehaviour { | |
public delegate IEnumerator StateHandler(); | |
public enum State { | |
Idle, | |
Attack, |
NewerOlder