Example #1
0
    private void Awake()
    {
        _healthAndShields = GetComponentInChildren <HealthAndShields>();

        _material = GetComponent <MeshRenderer>().materials[1];

        _emissiveColor = _material.GetColor("_EmissiveColor");
        _baseColor     = _material.GetColor("_BaseColor");
    }
Example #2
0
    /// <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);
            }
        }
    }
Example #3
0
    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>();
    }
Example #4
0
    /// <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;
        }
    }
Example #5
0
 public CargoPatrolState(CargoController enemyController, HealthAndShields has, GameObject thisGo) : base(enemyController)
 {
     thisGO = thisGo;
     health = has;
 }