void Start() { //if (staticRef == null) //{ //staticRef = this; rBody = this.transform.GetComponent <Rigidbody>(); behaviourState = EnemyBehaviourState.Default; //} }
protected void MoveToPoint(EnemyPoint point, float time) { _endMovePosition = point.Point.position; point.OccupyPoint(this); StopOccupyingActualPoint(); _actualPoint = point; _startMovePosition = transform.position; _currentLevelHandler.ChangeStateOfEnemy(Enemy, EnemyBehaviourState.Idle); State = EnemyBehaviourState.MovingToPoint; _timeToMove = time; _idleTimer = 0; _moveTimer = 0; }
public override void OnEnemyStateChanged(Enemy enemy, EnemyBehaviourState state) //UWAGA UWZGLEDNIAC SMIERC PRZY LICZENIU COUNT { CrabBehaviour crab = EnemyToCrabBehaviour(enemy); if (crab.MovedToSecondPoint && state == EnemyBehaviourState.Idle) { _count++; if (_count == _crabBehaviours.Count) { _count = 0; _waitingForMove = true; } } }
private void AIPursue() { float distanceFromDestination = (path[path.Count - 1].GetPosition() - this.transform.position).magnitude; if (distanceFromDestination > i_pursuingDistance) { Vector3 movementDirection = (FindLastVisibleNavPoint(i_size).GetPosition() - transform.position).normalized; velocity = movementDirection * i_movementSpeed; velocity.Set(velocity.x, 0f, velocity.z); rBody.velocity = velocity; } if (distanceFromDestination <= i_pursuingDistance) { behaviourState = EnemyBehaviourState.Default; Debug.Log("nolongerinpursuit"); } }
private void AIDefault() { velocity = new Vector3(0f, 0f, 0f); velocity.Set(velocity.x, 0f, velocity.z); rBody.velocity = velocity; //if (WithinSightOfPlayer()) if (isAIEnabled) { path = BetterNavNet.FindPath(nearestNavPoint, PlayerMovementAndRotation.nearestNavPoint, i_size); pathElementIndex = 0; if (path != null) { LineRenderingThing.staticRef.DrawPath(path); behaviourState = EnemyBehaviourState.Pursue; } } }
public abstract void OnEnemyStateChanged(Enemy enemy, EnemyBehaviourState state);
public void ChangeStateOfEnemy(Enemy enemy, EnemyBehaviourState targetState) { enemy.BehaviourScript.State = targetState; OnEnemyStateChanged(enemy, targetState); }
public override void OnEnemyStateChanged(Enemy enemy, EnemyBehaviourState state) { }
private void StopMoving() { State = EnemyBehaviourState.Idle; }