- Protoyped on the AI movement, found solutions for turns and moving after impacting the player. - Created a full base for AI state machine. - Worked on binding the core AI logic with the finite state machine.
41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
|
{
|
|
[SerializeField] private GameObject[] allCarsInScene; // contains enemy cars and player car
|
|
[]
|
|
[SerializeField] private PlayerCarController playerCarController; // TODO :: initialize roamPoints here
|
|
|
|
[SerializeField] private List<Transform> roamPoints; // TODO :: initialize roamPoints here
|
|
|
|
public PlayerCarController CarController => playerCarController;
|
|
|
|
public void Initialize()
|
|
{
|
|
InterfaceManager.Instance?.RegisterInterface<GameplayManager>(this);
|
|
}
|
|
|
|
public void InitializeData()
|
|
{
|
|
foreach (var car in allCarsInScene)
|
|
{
|
|
car.GetComponent<ICar>().Init(this);
|
|
}
|
|
}
|
|
|
|
public Vector3 GetRoamingPoint()
|
|
{
|
|
var randomIndex = Random.Range(0, roamPoints.Count);
|
|
return roamPoints[randomIndex].position;
|
|
}
|
|
|
|
public Transform GetTargetToAttack()
|
|
{
|
|
var randomIdx = Random.Range(0, allCarsInScene.Length);
|
|
return allCarsInScene[randomIdx].transform;
|
|
}
|
|
}
|