private void Awake() { _healthAndShields = GetComponentInChildren <HealthAndShields>(); _material = GetComponent <MeshRenderer>().materials[1]; _emissiveColor = _material.GetColor("_EmissiveColor"); _baseColor = _material.GetColor("_BaseColor"); }
/// <summary> /// Kills all enemeis in the area /// </summary> public void KillEnemies() { foreach (Transform enemy in currentArea.enemies) { HealthAndShields healthAndShields = enemy.GetComponentInChildren <HealthAndShields>(); if (healthAndShields) { healthAndShields.TakeDamage(Mathf.Infinity, Mathf.Infinity); } } }
private void Awake() { _shipController = GetComponent <ShipController>(); _slider_Health = GameObject.Find("[Slider] Health").GetComponent <Slider>(); _slider_Shield = GameObject.Find("[Slider] Shield").GetComponent <Slider>(); _slider_Boost = GameObject.Find("[Slider] Boost").GetComponent <Slider>(); _healthImage = _slider_Health.gameObject.GetComponentInChildren <Image>(); _shieldImage = _slider_Shield.gameObject.GetComponentInChildren <Image>(); _boostImage = _slider_Boost.gameObject.GetComponentInChildren <Image>(); _shipHealth = GetComponent <HealthAndShields>(); }
/// <summary> /// Transition to new state /// </summary> private void UpdateState() { if (!shipController) { shipController = GameObject.FindGameObjectWithTag("Player").GetComponent <ShipController>(); } HealthAndShields healthAndShields = shipController.GetComponent <HealthAndShields>(); switch (gameState) { case GameState.BATTLE: MusicManager.instance.RandomTrack(MusicTrackType.COMBAT); healthAndShields.Invincible = false; shipController.Warping = false; //WarpEffectBehaviour.instance.WarpTransitionSpeed = 40; WarpEffectBehaviour.instance.EndWarp(); startup = false; break; case GameState.BATTLE_END: MusicManager.instance.RandomTrack(MusicTrackType.NON_COMBAT); healthAndShields.ResetValues(); healthAndShields.Invincible = true; AreaManager.Instance.EndArea(); break; case GameState.PAUSE: break; case GameState.WARPING: shipController.Warping = true; shipController.Freeze = false; shipController.StopThrust = false; shipController.AlignGunnerWithPilot(); if (!startup) { WarpEffectBehaviour.instance.StartWarp(); } //AreaManager.Instance.LoadNewArea(); StartCoroutine(DelayedAreaLoad()); break; case GameState.GAME_OVER: case GameState.VICTORY: StartCoroutine(DelayedExit()); break; } }
public CargoPatrolState(CargoController enemyController, HealthAndShields has, GameObject thisGo) : base(enemyController) { thisGO = thisGo; health = has; }