private void Update() { if (_MasterObjectSpawner == null) { _MasterObjectSpawner = FindObjectOfType <MasterObjectSpawner>(); } if (_MasterResourcesMeter == null) { _MasterResourcesMeter = FindObjectOfType <MasterResourcesMeter>(); } if (_MasterObjectSpawner != null) { _CooldownTimer = _MasterObjectSpawner.GetCDTimer(); if (_MasterResourcesMeter != null) { if (_AbilityData.Cost > _MasterResourcesMeter.ClayPool) { _IsSpawnable = false; } else { _IsSpawnable = true; } } if (_IsSpawnable == true) { GetComponent <Image>().color = Color.white; Cooldown(); } if (_IsSpawnable == false) { GetComponent <Image>().color = Color.red; } } }
private void Awake() { _MyCam = GetComponentInChildren <Camera>(); _MinionSpawner = GetComponent <MasterObjectSpawner>(); }