예제 #1
0
 /// <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("Чет не так");
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Установить начальные переменные
        /// </summary>
        public virtual void Start()
        {
            if (!isServer)
            {
                return;            // Выполняется только на сервере
            }
            respawnWaver = GameObject.FindGameObjectWithTag("Core")
                           .GetComponent <RespawnWaver>();
            if (GameObject.FindGameObjectWithTag("Core").
                GetComponent <RespawnWaver>().IsEndWave &&
                GameObject.FindGameObjectWithTag("Core").
                GetComponent <RespawnWaver>().NumberOfEnemies == 0)
            {
                stopping = true;
            }

            _points     = new bool[4];
            _maskCursor = 1 << 9;
            for (byte i = 0; i < _points.Length; i++)
            {
                _points[i] = false;
            }
            _maxEdge = _standartRadius / 4;
            if (_isTurrel)
            {
                _maxEdge *= 2;
            }
            _startColor                  = _spriteRenderer.color;
            _isStoppingWalkFight         = false;
            _isAlive                     = true;
            _moveBack                    = false;
            _canToNull                   = false;
            _isFighting                  = false;
            _isReturning                 = false;
            _canToChangeCofForChangeAnim = true;
            _canRandomWalk               = true;
            _timer             = _restartTimer;
            _animFlag1         = true;
            _animFlag2         = true;
            _animFlag3         = true;
            _animFlag4         = true;
            _cofForChangeAnim  = _cofForRest;
            _startPosition     = gameObject.transform.position;
            _canPlayAnimAttack = true;

            // Апгрейдовые переменные
            _playerDmgNear = _standartDmgNear;
            _hpTurrelTemp  = _hpTurrel;
            SetNewAgentSpeed();

            StartMethod();
        }
예제 #3
0
        /// <summary>
        /// Старт
        /// </summary>
        void Start()
        {
            if (!isServer)
            {
                return;
            }

            // Выполняется только на сервере
            SaveCaching();
            transform.position
                      = new Vector3(transform.position.x, 0.1f, transform.position.z);
            _angle    = rnd.Next(180, 720);
            _quar     = Quaternion.Euler(90, _angle, 0);
            _speedVec = new Vector3((float)rnd.NextDouble()
                                    * rnd.Next(-1, 2) * _accuracy, 0, _speed);
            GetComponent <BulletMotionSync>().SpeedVec = _speedVec;
            respawnWaver = GameObject.FindGameObjectWithTag("Core")
                           .GetComponent <RespawnWaver>();
        }
예제 #4
0
        /// <summary>
        /// Старт
        /// </summary>
        void Start()
        {
            if (!isServer)
            {
                return;
            }

            respawnWaver = GameObject.FindGameObjectWithTag("Core")
                           .GetComponent <RespawnWaver>();
            CmdBangAudio();
            _speedVector = new Vector3(0, 0, _speed);

            _angle = 360 / _countOfClusterings;

            for (int i = 0; i < _countOfClusterings; i++)
            {
                CmdInstantiate(i);
            }

            Destroy(gameObject, _timerToDestroy);
        }