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);
            }
        }
示例#2
0
        public override void Enter()
        {
            base.Enter();
            _begin        = Time.time;
            _spitPosition = _iceCrow.getThrowChainPosition().position;

            /*WaterCrow w = _waterCrow;
             * Transform _waterSpit = _waterCrow.getThrowChainPosition();*/

            _counter = 0f;
            _lineRenderer.enabled = true;
            _lineRenderer.SetPosition(0, _spitPosition);
            _lineRenderer.startWidth = 0.3f;
            _lineRenderer.endWidth   = 0.3f;
            try{
                _waterCrow = _iceCrow.GetWaterCrow();
                if (_waterCrow == null)
                {
                    _stateMachine.ChangeState(_iceCrow._MoveState);
                }

                _dist        = Vector3.Distance(_spitPosition, _waterCrow.getThrowChainPosition().position);
                _distToHalja = Vector3.Distance(_spitPosition, _iceCrow.GetHalja().getThrowChainPosition().position);
                if (!_iceCrow.IsIneluttable())
                {
                    _secondLr         = _iceCrow.getThrowChainPosition().GetComponent <LineRenderer>();
                    _secondLr.enabled = true;
                    _secondLr.SetPosition(0, _spitPosition);
                    _secondLr.startWidth = 0.3f;
                    _secondLr.endWidth   = 0.3f;
                }
            }catch (NullReferenceException e) {
                _stateMachine.ChangeState(_iceCrow._MoveState);
            }catch (MissingReferenceException m) {
                _stateMachine.ChangeState(_iceCrow._MoveState);
            }
        }
        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);
            }
        }