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);
            }
        }
Esempio n. 3
0
        public override void Update()
        {
            base.Update();
            try{
                _iceCrow.setPlayerPosition(_iceCrow.isPlayerInAggroRange());

                if (!_iceCrow.IsIneluttable())
                {
                    if (_secondCounter <= _distToHalja) //just a simple animation
                    {
                        _secondCounter += .1f / _lineDrawSpeed;
                        float   x              = Mathf.Lerp(0, _distToHalja, _secondCounter);
                        Vector3 pointA         = _spitPosition;
                        Vector3 pointB         = _iceCrow.GetHalja().getThrowChainPosition().position;
                        Vector3 pointAngleLine = x * Vector3.Normalize(pointB - pointA) + pointA;
                        _secondLr.SetPosition(1, pointAngleLine);
                    }
                }

                if (_counter <= _dist) //just a simple animation
                {
                    _counter += .1f / _lineDrawSpeed;
                    float   x              = Mathf.Lerp(0, _dist, _counter);
                    Vector3 pointA         = _spitPosition;
                    Vector3 pointB         = _waterCrow.getThrowChainPosition().position;
                    Vector3 pointAngleLine = x * Vector3.Normalize(pointB - pointA) + pointA;
                    _lineRenderer.SetPosition(1, pointAngleLine);
                }
                _lineRenderer.SetPosition(0, _spitPosition);
                _lineRenderer.SetPosition(1, _waterCrow.getThrowChainPosition().position);
                if (!_iceCrow.IsIneluttable())
                {
                    _secondLr.SetPosition(0, _spitPosition);
                    _secondLr.SetPosition(1, _iceCrow.GetHalja().getThrowChainPosition().position);
                }

                RaycastHit Hit;

                if (Physics.Raycast(_spitPosition, (_waterCrow.getThrowChainPosition().position - _spitPosition).normalized, out Hit,
                                    Vector3.Distance(_spitPosition, _waterCrow.getThrowChainPosition().position), LayerMask.GetMask("Player")))
                {
                    StunData st = new StunData();
                    st.isEmpty = false;
                    st.time    = 3f;
                    Hit.collider.gameObject.GetComponent <PlayerStatus>().AddStatus(new Effects(new SlowData(), st, new DamageOverTimeData(),
                                                                                                new DamageData(), new FearData(), false, new SlowOverAreaData(), new DamageOverAreaData(), new EnhanceData()));
                }

                if (!_iceCrow.IsIneluttable())
                {
                    if (Physics.Raycast(_spitPosition, (_iceCrow.GetHalja().getThrowChainPosition().position - _spitPosition).normalized, out Hit,
                                        Vector3.Distance(_spitPosition, _iceCrow.GetHalja().getThrowChainPosition().position), LayerMask.GetMask("Player")))
                    {
                        StunData st = new StunData();
                        st.isEmpty = false;
                        st.time    = 3f;
                        Hit.collider.gameObject.GetComponent <PlayerStatus>().AddStatus(new Effects(new SlowData(), st, new DamageOverTimeData(),
                                                                                                    new DamageData(), new FearData(), false, new SlowOverAreaData(), new DamageOverAreaData(), new EnhanceData()));
                    }
                }

                if (Time.time >= _begin + _iceCrow.getUnbreakableBondDuration())
                {
                    _stateMachine.ChangeState(_iceCrow._MoveState);
                }
            }catch (NullReferenceException e) {
                _stateMachine.ChangeState(_iceCrow._MoveState);
            }catch (MissingReferenceException m) {
                _stateMachine.ChangeState(_iceCrow._MoveState);
            }
        }