Esempio n. 1
0
    void CellClicked()
    {
        if (state == States.PlayerL || state == States.PlayerR)
        {
            draw_state = input.GetSelectedState();

            for (int _x = 0; _x < tiles.CELL_SIZE_X; _x++)
            {
                for (int _y = 0; _y < tiles.CELL_SIZE_Y; _y++)
                {
                    if (state == States.PlayerL)
                    {
                        if (sendevents[_x, _y].fire == true && action_enabled == true)
                        {
                            tiles.Consume(0, tiles.cells[_x, _y], draw_state);
                            tiles.Set_Cell(tiles.cells, _x, _y, draw_state);
                            sendevents[_x, _y].fire = false;
                            action_enabled          = false;
                        }
                    }
                    else if (state == States.PlayerR)
                    {
                        if (sendevents[_x, _y].fire == true && action_enabled == true)
                        {
                            tiles.Consume(1, tiles.cells[_x, _y], draw_state);
                            tiles.Set_Cell(tiles.cells_another, _x, _y, draw_state);
                            sendevents[_x, _y].fire = false;
                            action_enabled          = false;
                        }
                    }
                }
            }
            draw.Draw();
        }
    }
Esempio n. 2
0
    void CellClicked()
    {
        if (is_discrete)
        {
            draw_state = input.GetSelectedState();

            for (int _x = 0; _x < tiles.CELL_SIZE_X; _x++)
            {
                for (int _y = 0; _y < tiles.CELL_SIZE_Y; _y++)
                {
                    if (state == States.PlayerL)
                    {
                        if (sendevents[_x, _y].fire == true && action_enabled == true && tiles.GetCost(0, draw_state) <= tiles.resources[0])
                        {
                            tiles.Consume(0, tiles.cells[_x, _y], draw_state);
                            tiles.Set_Cell(tiles.cells, _x, _y, draw_state);
                            sendevents[_x, _y].fire = false;
                            action_enabled          = false;
                            draw.Draw();
                        }
                    }
                    else if (state == States.PlayerR)
                    {
                        if (sendevents[_x, _y].fire == true && action_enabled == true && tiles.GetCost(1, draw_state) <= tiles.resources[1])
                        {
                            tiles.Consume(1, tiles.cells[_x, _y], draw_state);
                            tiles.Set_Cell(tiles.cells_another, _x, _y, draw_state);
                            sendevents[_x, _y].fire = false;
                            action_enabled          = false;
                            draw.Draw();
                        }
                    }
                }
            }
        }
        else
        {
            for (int _x = 0; _x < tiles.CELL_SIZE_X; _x++)
            {
                for (int _y = 0; _y < tiles.CELL_SIZE_Y; _y++)
                {
                    if (state == States.PlayerL)
                    {
                        if (sendevents[_x, _y].fire == true && action_enabled == true)
                        {
                            if (tiles.CanSetPattern(_x, _y, 0, tiles.RANGE))
                            {
                                tiles.SetPattern(_x, _y, 0, draw_state);
                                sendevents[_x, _y].fire = false;
                                action_enabled          = false;
                                draw.Draw();
                            }
                        }
                    }
                    else if (state == States.PlayerR)
                    {
                        if (sendevents[_x, _y].fire == true && action_enabled == true)
                        {
                            if (tiles.CanSetPattern(_x, _y, 1, tiles.RANGE))
                            {
                                tiles.SetPattern(_x, _y, 1, draw_state);
                                sendevents[_x, _y].fire = false;
                                action_enabled          = false;
                                draw.Draw();
                            }
                        }
                    }
                }
            }
        }
    }