Exemple #1
0
    // Update is called once per frame
    public override void Update()
    {
        base.Update();
        timeSinceStart += Time.deltaTime;
        if (timeSinceStart > delay)
        {
            ClearAsteroids();
            if (input.getInputPresence())
            {
                player.health -= intensity * Time.deltaTime * damageMod;
            }
            if (!spawned)
            {
                GameObject.Instantiate(solarFlareVisual);
                spawned = true;
            }
        }

        if (timeSinceStart > delay - 1 && !warning.transform.GetChild(0).gameObject.activeInHierarchy)
        {
            SetWarningShown(true);
            sound.PlaySound(SoundManager.SoundID.SID_SOLAR_FLARE_PHASE);
        }

        if (timeSinceStart > delay + duration)
        {
            sound.PlaySound(SoundManager.SoundID.SID_SOLAR_FLARE_CLEAR);
            SetWarningShown(false);
            Destroy(gameObject);
        }
    }