Пример #1
0
 private void UpdateDrugTimer(float time)
 {
     if (DrugTimer > 0)
     {
         DrugTimer -= time * moveSpeed;
     }
     else
     {
         DrugTimer = 0;
         if (CurrentActiveDrug != null)
         {
             CurrentActiveDrug.EndEffect();
             CurrentActiveDrug = null;
         }
     }
 }
Пример #2
0
    private void UseDrug()
    {
        if (Drug1 != DrugType.None)
        {
            if (CurrentActiveDrug != null)
            {
                CurrentActiveDrug.EndEffect();
            }

            switch (Drug1)
            {
            case DrugType.WhiteEye:
                DrugLevel        += 6;
                DrugTimer         = 4;
                CurrentActiveDrug = new WhiteEyeEffect();
                break;

            case DrugType.Thorn:
                DrugLevel        += 10;
                DrugTimer         = 6;
                CurrentActiveDrug = new ThornEffect();
                break;

            case DrugType.Knight:
                DrugLevel        += 18;
                DrugTimer         = 10;
                CurrentActiveDrug = new KnightEffect();
                break;

            default:
                break;
            }
            audioSource.PlayOneShot((AudioClip)Resources.Load("sfx/SFX_POWERUP"));
            CurrentActiveDrug.StartEffect();

            Drug1 = Drug2;
            Drug2 = DrugType.None;
        }
    }