public static Oponent Create(OponentType oponentType) { Oponent oponent; switch (oponentType) { case OponentType.human: oponent = new Player(); break; case OponentType.computer: oponent = new ComputerOponent(); break; case OponentType.humanLAN: oponent = new OponentLAN(); break; default: Debug.LogError("Unknown oponent"); oponent = null; break; } return(oponent); }
public IEnumerator StartNewGame(OponentType type1, OponentType type2) { int rnd = UnityEngine.Random.Range(0, 2); player = OponentFactory.Create(type1).Create((TileValue)rnd + 1); computer = OponentFactory.Create(type2).Create((TileValue)2 - rnd); yield return(new WaitUntil(() => player.IsReady)); yield return(new WaitUntil(() => computer.IsReady)); }
public void ChangeOponent2(int newType) => oponentType2 = (OponentType)newType;
// Called in UI public void ChangeOponent1(int newType) => oponentType1 = (OponentType)newType;