// Update is called once per frame
    void Update()
    {
        if (localHealth != health)
        {
            SplatterBloodCamera.Play();
            //FrameBloodCamera.Play();
            hitSound.Play();
            bloodRainController.Attack(49);
            localHealth = health;
            StopAllCoroutines();
            StartCoroutine(WaitingForRegen());
        }

        if (health < 0 && !dead)
        {
            dead = true;
            StopAllCoroutines();
            this.GetComponent <Animation>().Play("death");
        }

        if (dead)
        {
            Invoke("EndGame", 4.0f);
        }
    }
Exemple #2
0
 private void FixedUpdate()
 {
     if (m_TextMeshPro.text != "")
     {
         float remainingTime = float.Parse(m_TextMeshPro.text);
         if (Mathf.Abs(remainingTime - Mathf.FloorToInt(remainingTime)) < 0.05f)
         {
             bloodRainController.Attack(30);
         }
     }
     else
     {
         bloodRainController.Reset();
     }
 }
Exemple #3
0
    private void OnGUI()
    {
        if (playMode != PlayMode.None)
        {
            if (GuiButton("GoBack"))
            {
                StopAll();
                playMode = PlayMode.None;
            }
        }
        else
        {
            if (GuiButton("Blood"))
            {
                playMode = PlayMode.Blood;
            }

            if (GuiButton("Splash (in)"))
            {
                playMode = PlayMode.SplashIn;
            }

            if (GuiButton("Splash (out)"))
            {
                playMode = PlayMode.SplashOut;
            }

            if (GuiButton("Frozen"))
            {
                frozenValue = 0f;
                frozenRain.Play();
                windAudio.Play();
                playMode = PlayMode.Frozen;
            }
        }


        if (playMode == PlayMode.Blood)
        {
            if (GuiButton("Hit Damage"))
            {
                if (bloodRainController.HP <= 30)
                {
                    bloodRainController.Reset();
                    bloodRainController.HP = 100;
                }
                else
                {
                    damageAudio.Play();
                    bloodRainController.Attack(30);
                }
            }
            if (GuiButton("Reset"))
            {
                bloodRainController.Reset();
            }
            GUILayout.Label("Current HP = " + bloodRainController.HP.ToString());
            return;
        }

        if (playMode == PlayMode.SplashIn)
        {
            if (GuiButton("Play Effect"))
            {
                splashInAudio.Play();
                splashInRain.Refresh();
                splashInRain.Play();
            }
        }

        if (playMode == PlayMode.SplashOut)
        {
            if (GuiButton("Play Effect"))
            {
                splashOutAudio.Play();
                splashOutRain.Refresh();
                splashOutRain.Play();
            }
        }

        if (playMode == PlayMode.Frozen)
        {
            frozenRain.Alpha = frozenValue;
            GUILayout.Label("Frozen Value (Sliding right to freeze)");
            frozenValue      = GUILayout.HorizontalSlider(frozenValue, 0f, 1f, GUILayout.Height(40));
            windAudio.volume = frozenValue;
        }
    }