Exemplo n.º 1
0
    public static Squad GetRandomSquadForCurrentActAndDay(SquadType squadType)
    {
        var act         = GameState.Instance.Act;
        var doomCounter = GameState.Instance.DoomCounter.CurrentDoomCounter;

        return(GameAct.GetSquadForAct(act, squadType));
    }
    public void CellClicked(Cell sender, GameAct act)
    {
        var coors = (sender as Cell).Position;
        int row = coors.First, col = coors.Second;


        if (!Model.GameStarted())
        {
            Model.GenerateMines(row, col);
        }
        Debug.Log(act);
        Status = SelectTile(row, col, act);


        if (Status == GameStatus.Won)
        {
            NewGame();
        }
        else if (Status == GameStatus.Lost)
        {
            // View.DisplayGameOver(Model);
            // View.UpdateBoard(Model, true);

            //GetComponentsInParent<Cell>().Select(c =>
            //{
            //    if (c != null)
            //        c.Explode();
            //    return c;
            //});


            // NewGame();
        }
    }
    public GameStatus SelectTile(int row, int col, GameAct act)
    {
        Cell cell = Board[row, col];

        if (act == GameAct.Flag)
        {
            SetFlag(row, col);
            if (GameComplete())
            {
                return(GameStatus.Won);
            }
        }
        else
        {
            if (cell.Status == CellStatus.Mine)
            {
                cell.Status = CellStatus.Clear;
                //game over
                cell.Status = CellStatus.MineTripped;
                for (int r = 0; r < Rows; r++)
                {
                    for (int c = 0; c < Cols; c++)
                    {
                        Board[r, c].Explode();
                    }
                }

                return(GameStatus.Lost);
            }
            else
            {
                return(UpdateTileCount(row, col));
            }
        }
        return(GameStatus.Playing);
    }
 // Use this for initialization
 void Start()
 {
     Action = GameAct.Select;
 }
 GameStatus SelectTile(int row, int col, GameAct act)
 {
     return(Model.SelectTile(row, col, act));
 }