void Initialize() { //Create and set configurables //First all Monobehaviours if (gameUIManager == null) { gameUIManager = FindObjectOfType <GameUIManager>(); } if (audioManager == null) { audioManager = FindObjectOfType <AudioManager>(); } gameUIManager.SetSpawnConfig(configsReferences.GetConfig(ConfigType.TetrominoSpawn)); audioManager.SetSpawnConfig(configsReferences.GetConfig(ConfigType.Audio)); board = new Board(configsReferences.GetConfig(ConfigType.Board)); tetrominoManager = new TetrominoManager(configsReferences.GetConfig(ConfigType.TetrominoSpawn)); inputManager = new InputManager(configsReferences.GetConfig(ConfigType.KeyboardInput)); boardStateController = new BoardStateController(board, tetrominoManager, BoardStateType.InitState); }
// Use this for initialization void Awake() { count = 0; // Get BoardStateController Class boardController = GetComponent <BoardStateController>(); // Initialization Game Board Controller Class boardController.initialize(); }
public string MakeAIDecision(BoardStateController myBoardState) { string instructions = ""; //find nearest ball; (int, int)myClosestBall = myBoardState.FindClosestBallToEnemy(myAINumber); //simple AI decisions //1) If no ball, get ball //2) If no ball available, and not have ball, prep dodge/catch //3) If have ball, throw if (aiControl == "Simple") { if (myBoardState.myEnemyControllerObject.GetComponent <EnemyController>().enemyList[myAINumber].hasBall == -1 && myClosestBall != (-1, -1)) { //get ball instructions = "Move:" + myClosestBall + ";Pickup"; int moveX = myClosestBall.Item1; int moveY = myClosestBall.Item2; myBoardState.MoveEnemy(moveX, moveY, myAINumber); myBoardState.EnemyPickUpBall(myAINumber); } else if (myBoardState.myEnemyControllerObject.GetComponent <EnemyController>().enemyList[myAINumber].hasBall == -1 && myClosestBall == (-1, -1)) { //prep defense if (myBoardState.myEnemyControllerObject.GetComponent <EnemyController>().enemyList[myAINumber].agilityStat > myBoardState.myEnemyControllerObject.GetComponent <EnemyController>().enemyList[myAINumber].powerStat) { instructions = "Dodge"; myBoardState.SetEnemyDefense(myAINumber, "Dodge"); } else { instructions = "Catch"; myBoardState.SetEnemyDefense(myAINumber, "Catch"); } }
// Start is called before the first frame update void Start() { myBoardState = myBoardStateObject.GetComponent <BoardStateController>(); myText = myTMP.GetComponent <TextMeshProUGUI>(); }
// Start is called before the first frame update void Start() { myBoardState = myBoardStateObject.GetComponent <BoardStateController>(); }