示例#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);
            }
        }
示例#2
0
        public override void ExecuteAfterAnimation()
        {
            base.ExecuteAfterAnimation();

            Collider[] player = Physics.OverlapSphere(_crow.transform.position, _crow.getWhiplashesMaxDistance(), LayerMask.GetMask("Player"));
            _player = player.Length == 0 ? null : player[0];
            if (_player == null)
            {
                _stateMachine.ChangeState(_crow._MoveState);
            }
            else
            {
                _player.GetComponent <PlayerStatus>().TakeDamage(2f);
                _stateMachine.ChangeState(_crow._MoveState);
            }
        }