Beispiel #1
0
 protected void RpcBangAudio()
 {
     _audioSource.pitch = (float)rnd.NextDouble() / 4 + 0.9f;
     _audioSource.clip  = ResourcesPlayerHelper.
                          GetElementFromAudioBangs((byte)rnd.Next(0, ResourcesPlayerHelper.LenghtAudioBangs()));
     _audioSource.Play();
 }
 /// <summary>
 /// Каждый клиент загружает анимации
 /// </summary>
 public override void OnStartClient()
 {
     respawnWaver = GameObject.FindGameObjectWithTag("Core")
                    .GetComponent <RespawnWaver>();
     if (isServer)
     {
         _healthBarUnit.HealthUnit = Hp; // Задаем значение бара
         _currentAnimation         = ResourcesPlayerHelper.LenghtAnimationsPenguins() - 2;
     }
     else if (!isServer)
     {
         gameObject.name        = _enemyType;
         _spriteRenderer.flipX  = _isFlipped;
         _animatorOfEnemy.speed = this._animationSpeed;
         try
         {
             _animatorOfEnemy.runtimeAnimatorController
                 = ResourcesPlayerHelper.GetElementFromAnimationsPenguins(_currentAnimation);
         }
         catch
         {
             Debug.Log("Чет не так");
         }
     }
 }
 private void RpcChangeAnimation(int i, bool side)
 {
     _animatorOfEnemy.runtimeAnimatorController
         = ResourcesPlayerHelper.GetElementFromAnimationsPenguins(i);
     _spriteRenderer.flipX = side;
     if (isServer)
     {
         _isFlipped        = side;
         _currentAnimation = i;
     }
 }
 protected virtual void RpcChangeAnimation(int i, bool side)
 {
     //Debug.Log("АНимация");
     _animatorOfPlayer.runtimeAnimatorController
         = ResourcesPlayerHelper.GetElementFromAnimationsPenguins(i);
     _spriteRenderer.flipX = side;
     if (isServer)
     {
         _isFlipped        = side;
         _currentAnimation = i;
     }
 }
 private void PlayAudioForRadius(bool condition)
 {
     if (condition)
     {
         gameObject.GetComponent <AudioSource>().clip = ResourcesPlayerHelper.
                                                        GetElementFromAudioTaps(2);
         gameObject.GetComponent <AudioSource>().Play();
     }
     else
     {
         gameObject.GetComponent <AudioSource>().clip = ResourcesPlayerHelper.
                                                        GetElementFromAudioTaps(0);
         gameObject.GetComponent <AudioSource>().Play();
     }
 }
 /// <summary>
 /// Запуск ни клиентах
 /// </summary>
 public override void OnStartClient()
 {
     if (isServer)
     {
         _currentAnimation         = ResourcesPlayerHelper.LenghtAnimationsPenguins() - 1;
         _healthBarUnit.HealthUnit = HpTurrel; // Задаем значение бара
     }
     else if (!isServer)
     {
         gameObject.name         = _playerType;
         _spriteRenderer.flipX   = _isFlipped;
         _animatorOfPlayer.speed = this._animationSpeed;
         _animatorOfPlayer.runtimeAnimatorController
             = ResourcesPlayerHelper.GetElementFromAnimationsPenguins(_currentAnimation);
     }
 }
Beispiel #7
0
        protected override void RpcPlayAudio(byte condition)
        {
            switch (condition)
            {
            case 0:
                _audioSource.pitch = (float)randomer.NextDouble() / 2 + 0.9f;
                _audioSource.clip  = ResourcesPlayerHelper.
                                     GetElementFromAudioHitsCloseTurrel((byte)randomer.Next(0,
                                                                                            ResourcesPlayerHelper.LenghtAudioHitsCloseTurrel()));
                _audioSource.Play();
                break;

            case 1:
                _audioSource.pitch = (float)randomer.NextDouble() / 2 + 0.9f;
                _audioSource.clip  = ResourcesPlayerHelper.
                                     GetElementFromAudioHitsFarTurrel((byte)randomer.Next(0,
                                                                                          ResourcesPlayerHelper.LenghtAudioHitsFarTurrel()));
                _audioSource.Play();
                break;

            case 2:
                _audioSource.pitch = (float)randomer.NextDouble() + 1f;
                _audioSource.clip  = ResourcesPlayerHelper.
                                     GetElementFromAudioHitsFire((byte)randomer.Next(0,
                                                                                     ResourcesPlayerHelper.LenghtAudioHitsFire()));
                _audioSource.Play();
                break;

            case 3:
                _audioSource.pitch = (float)randomer.NextDouble() / 4 + 0.9f;
                _audioSource.clip  = ResourcesPlayerHelper.
                                     GetElementfromAudioPlants((byte)randomer.Next(0,
                                                                                   ResourcesPlayerHelper.LenghtAudioPlants()));
                _audioSource.Play();
                break;

            case 4:
                _audioSource.pitch = (float)randomer.NextDouble() / 3 + 0.9f;
                _audioSource.clip  = ResourcesPlayerHelper.
                                     GetElementFromAudioDeathsTurrel((byte)randomer.Next(0,
                                                                                         ResourcesPlayerHelper.LenghtAudioDeathsTurrel()));
                _audioSource.Play();
                break;
            }
        }
Beispiel #8
0
        public void RpcBurner(float burningTime, bool flag)
        {
            _can = false;
            if (flag)
            {
                _audio.clip = ResourcesPlayerHelper.
                              GetElementFromAudioDeathsObjects
                                  ((byte)rnd.Next(0, ResourcesPlayerHelper.LenghtAudioDeathsObjects()));
                _audio.pitch = (float)rnd.NextDouble() / 4 + 0.75f;
                _audio.Play();
            }

            GetComponent <BulletMotionSync>().IsStopped = true;
            transform.GetChild(0).localEulerAngles      = Vector3.zero;
            transform.GetChild(0).gameObject.SetActive(true);
            transform.GetChild(1).gameObject.SetActive(false);
            Destroy(gameObject, burningTime);
        }
        protected virtual void RpcPlayAudio(byte condition)
        {
            switch (condition)
            {
            case 0:
                _audioSource.pitch = (float)randomer.NextDouble() / 2 + 0.9f;
                _audioSource.clip  = ResourcesPlayerHelper.
                                     GetElementFromAudioHitsCloseUnit((byte)randomer.Next(0, ResourcesPlayerHelper.LenghtAudioHitsCloseUnit()));
                _audioSource.Play();
                break;

            case 1:
                _audioSource.pitch = (float)randomer.NextDouble() / 2 + 0.9f;
                _audioSource.clip  = ResourcesPlayerHelper.
                                     GetElementFromAudioHitsFarUnit((byte)randomer.Next(0, ResourcesPlayerHelper.LenghtAudioHitsFarUnit()));
                _audioSource.Play();
                break;

            case 2:
                _audioSource.pitch = (float)randomer.NextDouble() + 1f;
                _audioSource.clip  = ResourcesPlayerHelper.
                                     GetElementFromAudioHitsFire((byte)randomer.Next(0, ResourcesPlayerHelper.LenghtAudioHitsFire()));
                _audioSource.Play();
                break;

            case 3:
                _audioSource.pitch = (float)randomer.NextDouble() / 5 + 0.8f;
                _audioSource.clip  = ResourcesPlayerHelper.
                                     GetElementFromAudioShotsTurrel((byte)randomer.Next(0, ResourcesPlayerHelper.LenghtAudioShotsTurrel()));
                _audioSource.Play();
                break;

            case 4:
                _audioSource.pitch = (float)randomer.NextDouble() + 2f;
                _audioSource.clip  = ResourcesPlayerHelper.
                                     GetElementFromAudioDeathsUnit((byte)randomer.Next(0, ResourcesPlayerHelper.LenghtAudioDeathsUnit()));
                _audioSource.Play();
                break;
            }
        }
Beispiel #10
0
        protected virtual void RpcPlayGeneralSound(byte condition)
        {
            switch (condition)
            {
            case 0:
                _generalSounder.loop   = true;
                _generalSounder.volume = 0.5f;
                _generalSounder.pitch  = 1.5f;
                _generalSounder.clip   = ResourcesPlayerHelper.
                                         GetElementFromGeneralSounds((byte)rnd.Next(0, ResourcesPlayerHelper.LenghtGeneralSounds()));
                _generalSounder.Play();
                break;

            case 1:
                _generalSounder.pitch  = 1;
                _generalSounder.clip   = ResourcesPlayerHelper.GetElementFromOver(1);
                _generalSounder.volume = 1;
                _generalSounder.Play();
                _generalSounder.loop = false;
                break;

            case 2:
                _generalSounder.pitch  = 1;
                _generalSounder.clip   = ResourcesPlayerHelper.GetElementFromOver(2);
                _generalSounder.volume = 1;
                _generalSounder.Play();
                _generalSounder.loop = false;
                break;

            case 3:
                _generalSounder.pitch  = 1;
                _generalSounder.clip   = ResourcesPlayerHelper.GetElementFromOver(3);
                _generalSounder.volume = 1;
                _generalSounder.Play();
                _generalSounder.loop = false;
                break;
            }
        }
 /// <summary>
 /// Проигрываем щелчок
 /// </summary>
 /// <param name="i"></param>
 public void PlayAudio(byte i)
 {
     audioSource.clip = ResourcesPlayerHelper.
                        GetElementFromAudioTaps(i);
     audioSource.Play();
 }
 private void RpcPlayAudio()
 {
     gameObject.GetComponent <AudioSource>().clip = ResourcesPlayerHelper.
                                                    GetElementfromAudioUnitPlanted((byte)randomer.Next(0, ResourcesPlayerHelper.LenghtAudioUnitPlanted()));
     gameObject.GetComponent <AudioSource>().Play();
 }