public StateBase(AnimalAIController controller, AnimalStats stats, Animator animator, NavMeshAgent navMeshAgent) { animalController = controller; animalStats = stats; currentAnimator = animator; currentNavAgent = navMeshAgent; CurrentStageEvent = Event.Enter; }
// Generates Parent animals around a leader of the tribe on a specified angle and distance private void GetRandomParentAnimalSpawn() { for (int angle = 0; angle < 360; angle += _parentSpawnAngle) { var newSpawnPoint = _leaderSpawnPoint.position + Quaternion.Euler(0, angle, 0) * Vector3.forward * RandomSpawnPoint(_minParentAnimalSpawnDistance, _maxParentAnimalSpawnDistance); _parentsSpawnPoints.Add(newSpawnPoint); var targetPoint = Instantiate(_spawnPointPrefab, newSpawnPoint, Quaternion.identity, _leaderSpawnPoint); GameObject animalObject = Instantiate(_parentAnimalPrefab, newSpawnPoint, Quaternion.identity, transform); AnimalAIController animalController = animalObject.GetComponent <AnimalAIController>(); animalController.InitializeController(targetPoint); _allAnimalControllers.Add(animalController); } }
public MoveToNextAreaState(AnimalAIController controller, AnimalStats animalStats, Animator animator, NavMeshAgent navMeshAgent) : base(controller, animalStats, animator, navMeshAgent) { CurrentStateName = States.MoveToNextArea; }
public IdleState(AnimalAIController controller, AnimalStats animalStats, Animator animator, NavMeshAgent navMeshAgent) : base(controller, animalStats, animator, navMeshAgent) { CurrentStateName = States.Idle; }
public WalkAroundState(AnimalAIController controller, AnimalStats animalStats, Animator animator, NavMeshAgent navMeshAgent) : base(controller, animalStats, animator, navMeshAgent) { CurrentStateName = States.WalkAround; }