示例#1
0
 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);
        }
    }
示例#3
0
 public MoveToNextAreaState(AnimalAIController controller, AnimalStats animalStats, Animator animator, NavMeshAgent navMeshAgent) : base(controller, animalStats, animator, navMeshAgent)
 {
     CurrentStateName = States.MoveToNextArea;
 }
示例#4
0
 public IdleState(AnimalAIController controller, AnimalStats animalStats, Animator animator, NavMeshAgent navMeshAgent) : base(controller, animalStats, animator, navMeshAgent)
 {
     CurrentStateName = States.Idle;
 }
示例#5
0
 public WalkAroundState(AnimalAIController controller, AnimalStats animalStats, Animator animator, NavMeshAgent navMeshAgent) : base(controller, animalStats, animator, navMeshAgent)
 {
     CurrentStateName = States.WalkAround;
 }