Exemplo n.º 1
0
    private void placeTile(Vector2 startPos, Vector2 endPos)
    {
        if (!this.isValidPos(startPos) || !isValidPos(endPos))
        {
            return; //Invalid input
        }
        if (this.isAllSameTile(startPos, endPos))
        {
            return; //Noting to place here
        }
        Command c = new PlaceTileCommand(prefabPath, tileScale, map, layer, startPos, endPos);

        commandStack.perform(c);
    }
Exemplo n.º 2
0
 private void eraseTile(Vector2 startPos, Vector2 endPos)
 {
     if (!isValidPos(startPos) || !isValidPos(endPos))
     {
         return; //Invalid Coordinate
     }
     foreach (MapLayer layer in Enum.GetValues(typeof(MapLayer)))
     {
         if (!hasTilesToDelete(layer, startPos, endPos))
         {
             return; //Nothing to delete
         }
         Command c = new PlaceTileCommand("", Vector3.one, map, layer, startPos, endPos);
         commandStack.perform(c);
     }
 }