public bool IsMovePoint(int x, int y, int player, bool needToAdd = true) { if (MovePoints.ContainsKey(new Point(x, y))) { CanMove(x, y, player, needToAdd); return(true); } else { return(false); } }
// Start is called before the first frame update private IEnumerator Start() { this.enabled = false; while (!Input.GetButton("Jump")) { yield return(null); } this.enabled = true; GameObject newObstacle = Instantiate(obstacle); newObstacle.transform.position = transform.position + new Vector3(Random.Range(-position, position), 0, 0); Script = scriptObj.AddComponent <MovePoints>(); }
public void FindEnabledMoves(int player) { MovePoints.Clear(); for (int i = 0; i < Field.N; i++) { for (int j = 0; j < Field.N; j++) { int numberOfMoves = CanMove(i, j, player, false); if (numberOfMoves > 0) { MovePoints.Add(new Point(i, j), numberOfMoves); } } } GameProcess = MovePoints.Count > 0; }