Ejemplo n.º 1
0
    //check if an action is possible
    public bool CanDo(Action act, int x, int y) {

        string d = act.Do;
        string w = act.What;

        if (d == "paint")
            return world.CanPaintTerrain(w, x, y);

        else if (w == "Fence" && world.Map.IsUnblockedRoadAt(x, y))
            return true;

        else if (d == "place")
            return world.CanSpawnStructure(w, x, y, buildingRotation);

        else if (d == "demolish" || d == "unplace")
            return world.Map.GetBuildingAt(x, y) != null;

        else if (d == "rebuild")
            return true;

        return false;
    }
Ejemplo n.º 2
0
    //check if an action is possible
    public bool CanDo(Action act, int x, int y)
    {
        if (act.Do == "paint")
        {
            return(worldController.CanPaintTerrain(act.What, x, y));
        }

        else if (act.Do == "place")
        {
            return(worldController.CanSpawnStructure(act.What, x, y, buildingRotation));
        }

        else if (act.Do == "demolish" || act.Do == "unplace")
        {
            return(worldController.Map.GetBuildingAt(x, y) != null);
        }

        else if (act.Do == "rebuild")
        {
            return(true);
        }

        return(false);
    }