示例#1
0
        public void Tick()
        {
            if (_stopEdge.ReachEdge())
            {
                if (_stopEdge.IsRightDirection && !_isPlayerRightSide.Invoke())
                {
                    ChaseAgain(-1.5f, -1f, 1f);
                    return;
                }
                else if (!_stopEdge.IsRightDirection && _isPlayerRightSide.Invoke())
                {
                    ChaseAgain(1.5f, 1f, 1f);
                    return;
                }

                _animation.MoveAnimation(0f);
                return;
            }

            if (_isPlayerRightSide.Invoke())
            {
                _mover.Tick(1.5f);
                _flip.FlipCharacter(1f);
            }
            else
            {
                _mover.Tick(-1.5f);
                _flip.FlipCharacter(-1f);
            }
        }
示例#2
0
        public void OnEnter()
        {
            if (_patrols.Length < 1)
            {
                return;                                                                           // Eğer patrol gelmezse OnEnter çalışmasın.(bu sayede istersen düşmana sadece takip özelliği yüklersin)
            }
            _currentPatrol = _patrols[_patrolIndex];                                              //Hangi Patrolda olduğunu belirtiyor.

            Vector3 leftOfRight = _currentPatrol.position - _entityController.transform.position; //Patrolsun yerini hesaplıyor.

            if (leftOfRight.x > 0f)                                                               //Rota sağda mı kalıyor solda mı.
            {
                //Sağ
                _flip.FlipCharacter(1f);
            }
            else
            {
                //Sol
                _flip.FlipCharacter(-1f);
            }

            _direction = _entityController.transform.localScale.x;

            _animation.MoveAnimations(1f); //Yürüme Animasyonunu çalıştırıyor.

            IsWalking = true;              //State Machine'de burada kalmasını sağlıyor.
        }
示例#3
0
 public void Tick()
 {
     if (_isPlayerRightSide.Invoke()) //EnemyController içindeki IsPlayerRightSide Methodunu çalıştırır.
     {
         _mover.Tick(1.5f);
         _flip.FlipCharacter(1f);
     }
     else
     {
         _mover.Tick(-1.5f);
         _flip.FlipCharacter(-1f);
     }
 }
示例#4
0
        private void FixedUpdate()
        {
            _flip.FlipCharacter(_horizontal);
            _mover.Tick(_horizontal);

            _jump.TickWithFixedUpdate();
        }
示例#5
0
        private void FixedUpdate()
        {
            _flip.FlipCharacter(_horizontal);
            _mover.Tick(_horizontal);

            if (_isJump && _onGround.IsGround)
            {
                _jump.TickWithFixedUpdate();
                _isJump = false;
            }
        }
示例#6
0
        public void Tick()
        {
            _currentAttackTime += Time.deltaTime;
            if (_currentAttackTime > _maxAttackTime)
            {
                _flip.FlipCharacter(_isPlayerRightSide.Invoke()? 1f : -1f);

                _animation.AttackAnimation();
                //Attack Voice
                _attacker.Attack(_playerHealth);
                _currentAttackTime = 0f;
            }
        }
示例#7
0
        public void OnEnter()
        {
            if (_patrols.Length < 1)
            {
                return;
            }

            _currentPatrol = _patrols[_patrolIndex];

            Vector3 leftOfRight = _currentPatrol.position - _entityController.transform.position;

            _flip.FlipCharacter(leftOfRight.x > 0f ? 1f : -1f);

            _direction = _entityController.transform.localScale.x;

            _animation.MoveAnimation(1f);

            IsWalking = true;
        }