50 lines
1.1 KiB
C#
50 lines
1.1 KiB
C#
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;
|
|
|
|
[Header("AI difficulty, 0(easy)-3(hardest)")]
|
|
public int AIDifficulty = 1;
|
|
|
|
private void Awake() {
|
|
instance = this;
|
|
}
|
|
|
|
public void SetupGame(){
|
|
|
|
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();
|
|
|
|
player2.StartAI(new[] { 0.5f, 0.2f, 0.1f, 0f }[AIDifficulty]);
|
|
}
|
|
|
|
GameTransition.Instance.state = GameState.InGame;
|
|
}
|
|
|
|
}
|