Beispiel #1
0
    public bool IsBridgeCovered;    //  if this is true then this node isn't a building, its a special case
                                    // where a bridge from another node crosses over this node in the grid
                                    // needed to tell if a spot on the grid is occupied

    public StationNode()
    {
        buildings       = new LinkedList <StationBuilding>();
        hubBuildings    = new LinkedList <StationBuilding>();
        selectedHub     = null;
        IsBridgeCovered = false;
    }
Beispiel #2
0
 // returns false if no hub is available going down
 public bool SelectNextHubDown()
 {
     if (CanSelectDown())
     {
         return(false);
     }
     else
     {
         selectedHub = hubBuildings.Find(selectedHub).Next.Value;
     }
     return(true);
 }
Beispiel #3
0
 // returns false if no hub is available going up
 public bool SelectNextHubUp()
 {
     if (CanSelectUp())
     {
         return(false);
     }
     else
     {
         selectedHub = hubBuildings.Find(selectedHub).Previous.Value;
     }
     return(true);
 }
Beispiel #4
0
    // use this initialize for the first node of a space station which has no hubports used
    public void Initialize(bool isBigHub, Vector pos)
    {
        if (isBigHub)
        {
            selectedHub = new StationBuilding(BuildingType.MainConnector, pos, this);
        }
        else
        {
            selectedHub = new StationBuilding(BuildingType.SmallDisk, pos, this);
        }

        buildings.AddFirst(selectedHub);
        hubBuildings.AddFirst(selectedHub);
    }
Beispiel #5
0
    // use this initialize for the first node of a space station which has no hubports used
    public void Initialize(bool isBigHub, Vector3 pos)
    {
        if (isBigHub)
        {
            selectedHub = new StationBuilding(BuildingType.MainConnector, pos, this);
            selectedHub.buildingMesh = (GameObject)Instantiate(Resources.Load("MainConnector"));
            selectedHub.buildingMesh.transform.position = pos;
        }
        else
        {
            selectedHub = new StationBuilding(BuildingType.SmallDisk, pos, this);
        }

        buildings.AddFirst(selectedHub);
        hubBuildings.AddFirst(selectedHub);
    }
Beispiel #6
0
    public bool AddBuilding(bool top, BuildingType btype)
    {
        float newBuildingHeight = SpaceStation.buildingHeightTable[btype];

        if (top)
        {
            Vector3 buildingPos = buildings.First.Value.pos;
            if (!CanAddBuilding(top, btype, buildingPos, newBuildingHeight))
            {
                return(false);
            }
            buildingPos.y += newBuildingHeight + SpaceStation.buildingHeightTable[buildings.First.Value.type] / 2;
            StationBuilding newBuilding = new StationBuilding(btype, buildingPos, this);
            newBuilding.buildingMesh = MakeGameObjectInstance(btype);
            newBuilding.buildingMesh.transform.position = buildingPos;
            buildings.AddFirst(newBuilding);
            if (SpaceStation.IsHub(btype))
            {
                hubBuildings.AddFirst(newBuilding);
            }
        }
        else
        {
            Vector3 buildingPos = buildings.Last.Value.pos;
            if (!CanAddBuilding(top, btype, buildingPos, newBuildingHeight))
            {
                return(false);
            }
            buildingPos.y -= newBuildingHeight + SpaceStation.buildingHeightTable[buildings.Last.Value.type] / 2;
            StationBuilding newBuilding = new StationBuilding(btype, buildingPos, this);
            newBuilding.buildingMesh = MakeGameObjectInstance(btype);
            newBuilding.buildingMesh.transform.position = buildingPos;
            buildings.AddLast(newBuilding);
            if (SpaceStation.IsHub(btype))
            {
                hubBuildings.AddLast(newBuilding);
            }
        }
        return(true);
    }