Example #1
0
    public bool AssignInstalledObject(InstalledObject objInstance)
    {
        if (objInstance == null)
        {
            return(UnassignInstalledObject());
        }

        if (!objInstance.IsValidPosition(this))
        {
            Debug.LogError("Trying to assign an installed object to a tile that isn't valid!");
            return(false);
        }

        for (int x_off = X; x_off < (X + objInstance.Width); x_off++)
        {
            for (int y_off = Y; y_off < (Y + objInstance.Height); y_off++)
            {
                Tile tile = World.GetTileAt(x_off, y_off);
                tile.InstalledObject = objInstance;
            }
        }

        return(true);
    }