Exemplo n.º 1
0
 private void OnIncrementPowerEvent(object sender, IncrementPowerEventArgs incrementPowerEventArgs)
 {
     if (incrementPowerEventArgs.CurrentPower == 0)
     {
         SoundService.PlayClip(_audioSource, AudioClipsEnum.PowerUp);
     }
     if (incrementPowerEventArgs.CurrentPower < Bars.Length)
     {
         Bars[incrementPowerEventArgs.CurrentPower].gameObject.SetActive(true);
     }
 }
        private void Kill()
        {
            SoundService.PlayClip(AudioClipsEnum.UnitKilled);
            GameObjectsProviderService.MainGameController.MatchController.RemoveUnit(this);

            gameObject.SetActive(false);

            GameObjectsProviderService.MainGameController.EndMatchIfNeeded();
            if (AllowControll)
            {
                GameObjectsProviderService.MainGameController.NewRound();
            }
        }
        public void ChangeHp(int amount)
        {
            var newHp = Hp + amount;

            if (newHp > 100)
            {
                newHp = 100;
            }
            if (newHp < 0)
            {
                newHp = 0;
            }
            else if (amount < 0)
            {
                SoundService.PlayClip(AudioClipsEnum.UnitDamaged);
            }
            Hp = newHp;

            if (Hp < 1)
            {
                Kill();
            }
        }
Exemplo n.º 4
0
        public void ExplodeNow(GameObject actualCollider)
        {
            SoundService.PlayClip(WeaponDefinitionHolder.WeaponDefinition.ClipOnExplode);
            if (actualCollider != null)
            {
                switch (actualCollider.tag)
                {
                case Tags.Map:
                    ColideWithMap(actualCollider);
                    break;

                case Tags.Unit:
                    ColideWithUnit(actualCollider);
                    break;

                case Tags.Bullet:
                    ColideWithBullet(actualCollider);
                    break;
                }
            }

            Invoke("DisableObject", 0.1f);
        }
Exemplo n.º 5
0
 private object Tick()
 {
     SoundService.PlayClip(WeaponDefinitionHolder.WeaponDefinition.ClipOnTimerCount);
     return(new WaitForSeconds(1));
 }