Пример #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);
            }
        }