public GameObject GetNewBot(Vector3 botPosition, BotBehavior.BehaviorType bType) { GameObject newBot = botPooler.GetPooledObject(); if (newBot != null) { newBot.transform.position = botPosition; BotBehavior newBotScript = newBot.GetComponent <BotBehavior>(); newBotScript.behaviorType = bType; newBotScript.gameControllerInstance = this.gameObject; newBotScript.Corrupt(false); newBotScript.bullet = null; newBotScript.ReStart(); newBot.SetActive(true); } return(newBot); }
void CreateBot(BotBehavior.BehaviorType bType) { Vector3 offset = transform.position; if (myDirection == Direction.up) { offset.y += botSpawnDist; } else if (myDirection == Direction.down) { offset.y -= botSpawnDist; } else if (myDirection == Direction.right) { offset.x += botSpawnDist; } else if (myDirection == Direction.left) { offset.x -= botSpawnDist; } this.gameControllerInstance.GetComponent <GameController>().GetNewBot(offset, bType); }