2020-08-22 05:29:00 +00:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class GameBoardInstance : MonoBehaviour {
|
|
|
|
|
|
|
|
|
|
public static GameBoardInstance instance { get; private set; }
|
|
|
|
|
|
|
|
|
|
public GameBoard player1, player2;
|
|
|
|
|
|
|
|
|
|
public GameObject tilePrefab;
|
|
|
|
|
public Sprite[] regular;
|
|
|
|
|
public Sprite[] lit;
|
|
|
|
|
public Sprite[] activators;
|
|
|
|
|
|
|
|
|
|
private void Awake() {
|
|
|
|
|
instance = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetupGame(){
|
2020-08-22 07:34:54 +00:00
|
|
|
|
|
2020-08-22 05:29:00 +00:00
|
|
|
|
if (NetworkManager.inRoom){
|
|
|
|
|
var players = NetworkManager.net.CurrentRoom.Players.Values.OrderBy(p => p.ID);
|
|
|
|
|
var p1 = players.ElementAt(0);
|
|
|
|
|
var p2 = players.ElementAt(1);
|
|
|
|
|
|
|
|
|
|
player1.authorityID = p1.ID;
|
|
|
|
|
player2.authorityID = p2.ID;
|
|
|
|
|
|
|
|
|
|
player1.Setup();
|
|
|
|
|
player2.Setup();
|
|
|
|
|
} else {
|
|
|
|
|
player1.authorityID = -1;
|
|
|
|
|
player2.authorityID = -1;
|
|
|
|
|
|
|
|
|
|
player1.Setup();
|
|
|
|
|
player2.Setup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GameTransition.Instance.state = GameState.InGame;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|