void Awake() { BoardProcessor board = FindObjectOfType <BoardProcessor>(); if (transform.parent != board) { transform.parent = board.transform; } }
public void endTurnTrigger(BotMovement bot) { BoardProcessor board = FindObjectOfType <BoardProcessor>(); TurnManager turnManager = FindObjectOfType <TurnManager>(); Vector3 botPosition = bot.transform.position; Waypoint moveToWaypoint = board.GetNearestWaypoint(new Vector2Int( Mathf.RoundToInt(botPosition.x + transform.forward.x * moveSpaces), Mathf.RoundToInt(botPosition.z + transform.forward.z * moveSpaces) )); if (moveToWaypoint != null) { bot.AddCommandToQueue(new Command("MOVE", moveToWaypoint)); } turnManager.AddPlayerToQueue(bot); }