示例#1
0
        public override void Update()
        {
            if (_entityData.health <= 0)
            {
                _stateMachine.ChangeState(_crow._death);
            }

            base.Update();

            if (Time.time >= _crow.getTimer() + _crow.getUnBreakableBondCountDown() && _crow.GetWaterCrow() != null)
            {
                _stateMachine.ChangeState(_crow._unbreakableBond);
            }

            if (_isDetectingPlayer)
            {
                _crow.setDirection((_playerPosition.position - _crow.transform.position).normalized);

                float dist = Vector3.Distance(_crow.transform.position, _playerPosition.position);

                //Debug.Log("still detecting, DIST = "+ dist+ " and min = "+_halja.getPunishmentMinDistance()+" and max= "+_halja.getPunishmentMaxDistance() );
                if (_crow.getWhipLashesMinDistance() <= dist && dist <= _crow.getWhiplashesMaxDistance() &&
                    Time.time >= (_crow.getWhipLashesClock() + _crow.getWhiplashesCountdown()))
                {
                    _stateMachine.ChangeState(_crow._whiplashes);
                }
            }
            else
            {
                _stateMachine.ChangeState(_crow._MoveState);
            }
        }
        public override void Update()
        {
            base.Update();

            _crow.setPlayerPosition(_crow.isPlayerInAggroRange());
            if (Time.time >= _crow.getTimer() + _crow.getUnBreakableBondCountDown() && _crow.GetWaterCrow() != null)
            {
                _stateMachine.ChangeState(_crow._unbreakableBond);
            }

            if (!_crow.IsIneluttable())
            {
                if (_isDetectingPlayer)
                {
                    _stateMachine.ChangeState(_crow._PlayerDetect);
                }
            }


            if (_isDetectingWall)
            {
                _crow._IdleState.setFlipAfterIdle(true);
                _stateMachine.ChangeState(_crow._IdleState);
            }
            else
            {
                _crow.Move(_entityData.movementSpeed);
            }
        }
        public override void Update()
        {
            base.Update();
            _crow.setPlayerPosition(_crow.isPlayerInAggroRange());

            if (!_crow.IsIneluttable())
            {
                if (_isDetectingPlayer)
                {
                    _stateMachine.ChangeState(_crow._PlayerDetect);
                }
            }

            if (Time.time >= _crow.getTimer() + _crow.getUnBreakableBondCountDown())
            {
                _stateMachine.ChangeState(_crow._unbreakableBond);
            }
            if (_isIdleTimeElapsed)
            {
                _stateMachine.ChangeState(_crow._MoveState);
            }
        }