void Awake() { cam = GetComponent <Camera>(); animator = GetComponent <Animator>(); gameData = GameObject.Find("GameData").GetComponent <GameData>(); gameData.OnStateChange += OnStateChange; horde = GameObject.Find("Horde").GetComponent <HordeScript>(); cameraInitialPosition = this.transform.position; centerScreen = horde.center.position; PlayerScript.OnPlayerDeath += OnPlayerDeath; }
// Start is called before the first frame update void Start() { this.GetComponent <Animator>().speed = UnityEngine.Random.Range(0.5f, 1.5f); hordeScript = GameObject.Find("Horde").GetComponent <HordeScript>(); gameData = GameObject.Find("GameData").GetComponent <GameData>(); // store the playerstats for the fat chef if it's in the game GameObject fatChef = GameObject.Find("FAT player"); if (fatChef != null) { stats = fatChef.GetComponent <PlayerScript>().stats; } }