// Use this for initialization void Awake() { stateMachine = GetComponent <BotStateMachine>(); navigator = GetComponent <IBotNavigator>(); attacker = GetComponent <BotAttacker>(); stateMachine.onStateChanged -= OnStateChanged; stateMachine.onStateChanged += OnStateChanged; }
void Start() { foreach (GameObject bot in GameObject.FindGameObjectsWithTag("Target")) { if (bot.GetComponent <Health>() && bot.GetComponent <AIMachine>()) { friendlyBots.Add(bot); } } friendlyBots.Remove(this.gameObject); friendlyBots.Remove(GameObject.Find("PlayerSphere")); foreach (GameObject obj in GameObject.FindGameObjectsWithTag("Cap Area")) //if there are any capture areas in the level, add them to the list { objectives.Add(obj); } foreach (GameObject obj in GameObject.FindGameObjectsWithTag("Terminal")) //if there are any terminals in the level, add them to the list { objectives.Add(obj); } botMachine = GetComponent <BotStateMachine>(); thisAgent = GetComponent <NavMeshAgent>(); botStats = GetComponent <BotStats>(); gameManager = GameObject.Find("Persistent Object").GetComponent <GameManager>(); logD = GameObject.Find("RunningUI/Text Log/Log Panel/Content").GetComponent <DisplayLog>(); playerObject = GameObject.Find("PlayerSphere"); laserLine = GetComponent <LineRenderer>(); laserLine.enabled = false; audioS = GetComponent <AudioSource>(); startingPos = transform.position; if (gameObject.name.Contains("Blue")) { displayName = "Blue Bot"; } if (gameObject.name.Contains("Green")) { displayName = "Green Bot"; } if (gameObject.name.Contains("Orange")) { displayName = "Orange Bot"; } }
private void CreateStateMachine() { BotStateMachine = new BotStateMachine(CoffeeBreakMock.Object, MessagingServiceMock.Object); }