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() { 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); } }