Пример #1
0
    public void AddMapSlot(string path)
    {
        GameObject mapSlotObj = Instantiate(mapSlotPrefab, mapSlotHolder.transform);

        MapSlot mapSlot = mapSlotObj.GetComponent <MapSlot>();

        mapSlot.SetPath(path, true);
    }
Пример #2
0
 public SeatMap(int cols, int rows)
 {
     NumCols = cols;
     NumRows = rows;
     Slots   = new MapSlot[rows][];
     for (var i = 0; i < rows; i++)
     {
         Slots[i] = new MapSlot[cols];
     }
 }
Пример #3
0
    public void CreatNewMap()
    {
        GameObject mapSlotObj = Instantiate(mapSlotPrefab, mapSlotHolder.transform);

        MapSlot mapSlot = mapSlotObj.GetComponent <MapSlot>();

        creationMenu.gameObject.SetActive(true);
        creationMenu.StartCreation(mapSlot);
        gameObject.SetActive(false);
    }
Пример #4
0
 public void StartCreation(MapSlot mapSlot)
 {
     myMapSlot = mapSlot;
 }
Пример #5
0
 public MapSlot SetOccupied(bool newValue)
 {
     MapSlot slot = new MapSlot(slotIndex,slotCoords,newValue);
     return slot;
 }
Пример #6
0
 public MapNode(MapSlot newSlot, MapRegion newRegion)
 {
     occupiedSlot = newSlot;
     region = newRegion;
 }
Пример #7
0
    Dictionary<Vector2, MapSlot> GenerateMapSlots()
    {
        int horTownSlots = 3;
        int vertTownSlots = 3;

        townSlotSideSize=Screen.height/vertTownSlots;

        float borderOffset = 20f;

        townAreaSpriteSize = 75f;

        float gapBetweenTownSlots = 0f;

        Dictionary<Vector2, MapSlot> townSlotCenters = new Dictionary<Vector2, MapSlot>();
        for (int i = 0; i < vertTownSlots; i++)
        {
            for (int j = 0; j < horTownSlots; j++)
            {
                //Y coord must be inverted because in UI elements higher Y goes up and lower Y goes down

                Vector2 newTownUpperleftPos
                = new Vector2(borderOffset + (townSlotSideSize + gapBetweenTownSlots) * j, -(borderOffset + (townSlotSideSize + gapBetweenTownSlots) * i));
                MapSlot newSlot = new MapSlot(new Vector2(j, i), newTownUpperleftPos + new Vector2(townSlotSideSize * 0.5f, -townSlotSideSize * 0.5f));
                townSlotCenters.Add(new Vector2(j, i), newSlot);//new Vector2(townSlotSideSize*j,townSlotSideSize*i));
                //print ("Slot:"+j+"|"+i+":"+newTownUpperleftPos);
            }
        }
        return townSlotCenters;
    }