44 lines
1 KiB
C#
44 lines
1 KiB
C#
![]() |
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class PlayerManager : MonoBehaviour
|
|||
|
{
|
|||
|
// Private players variable, used to keep track of which player has which spaces.
|
|||
|
// Should later be defined as a struct in a separate namespace.
|
|||
|
private static int[] players = new int[2];
|
|||
|
|
|||
|
// Function call to return what the indexed player's space choice is.
|
|||
|
public static int getPlayer(int n)
|
|||
|
{
|
|||
|
return players[n];
|
|||
|
}
|
|||
|
|
|||
|
/* Function called at the beginning of a game to set the player spaces
|
|||
|
* and reset the turn counter.
|
|||
|
*
|
|||
|
* This function should later be called by a manager script of some
|
|||
|
* kind that handles menu navigation/logistics between games and other
|
|||
|
* activity outside of the main game.
|
|||
|
*/
|
|||
|
public static void StartGame(int playerchoice)
|
|||
|
{
|
|||
|
players[0] = playerchoice;
|
|||
|
|
|||
|
switch(playerchoice)
|
|||
|
{
|
|||
|
case 1:
|
|||
|
players[1] = 2;
|
|||
|
break;
|
|||
|
case 2:
|
|||
|
players[1] = 1;
|
|||
|
break;
|
|||
|
default:
|
|||
|
Debug.Log("Invalid Player Choice!");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
GameManager.ResetTurn();
|
|||
|
}
|
|||
|
}
|