示例#1
0
 public void SetRoomInfoData(Enums.RoomSizes roomSize, Enums.RoomTypes roomType, Enums.RoomOverUnder roomOverUnder, GridIndex leftMostIndex)
 {
     RoomSize      = roomSize;
     RoomType      = roomType;
     RoomOverUnder = roomOverUnder;
     LeftmostIndex = leftMostIndex;
 }
示例#2
0
    public GameObject CreateRoom(Enums.RoomTypes roomType, Enums.RoomSizes roomSize, Enums.RoomOverUnder roomOverUnder)
    {
        RoomDefData DefData    = GetRoomDefData(roomType, roomSize, roomOverUnder);
        GameObject  RoomObject = LoadRoom(DefData);

        RoomObject.SetActive(true);
        return(RoomObject);
    }
示例#3
0
 // NOTE: OverUnder is defaulted to NEUTRAL, meaning the room will be buildable above and below ground unless otherwise specified!!!
 public RoomDefData(string roomName, string roomModelFile,
                    Enums.RoomSizes roomSize, Enums.RoomTypes roomType, Enums.RoomCategories roomCategory,
                    int manSlotCount, Enums.ManStates[] manWorkingStates,
                    string roomDescription, Enums.RoomOverUnder overUnder = Enums.RoomOverUnder.Neutral)
 {
     _RoomName         = roomName;
     _RoomModelFile    = roomModelFile;
     _RoomSize         = roomSize;
     _RoomType         = roomType;
     _RoomCategory     = roomCategory;
     _ManSlotCount     = manSlotCount;
     _ManWorkingStates = manWorkingStates;
     _RoomDescription  = roomDescription;
     _RoomOverUnder    = overUnder;
 }
示例#4
0
    public void CreateRoom(Guid roomId, Enums.RoomTypes roomType, Enums.RoomSizes roomSize, Enums.RoomOverUnder roomOverUnder, GridIndex leftMostIndex)
    {
        RoomDefData RoomDefData = RoomFactory.Ref.GetRoomDefData(roomType, roomSize, roomOverUnder);

        RoomInstanceData RoomData = new RoomInstanceData();

        RoomData.RoomId              = roomId;
        RoomData.RoomName            = RoomDefData.RoomName;
        RoomData.RoomSize            = RoomDefData.RoomSize;
        RoomData.RoomCategory        = RoomDefData.RoomCategory;
        RoomData.RoomType            = RoomDefData.RoomType;
        RoomData.RoomOverUnder       = RoomDefData.RoomOverUnder;
        RoomData.ManSlotCount        = RoomDefData.ManSlotCount;
        RoomData.ManSlotsPositions   = new Vector3[RoomDefData.ManSlotCount];    // Data will be set by object script on Start()
        RoomData.ManSlotsRotations   = new Quaternion[RoomDefData.ManSlotCount]; // Data will be set by object script on Start()
        RoomData.ManSlotsAssignments = new Guid[RoomDefData.ManSlotCount];
        for (int i = 0; i < RoomData.ManSlotCount; i++)
        {
            RoomData.ManSlotsAssignments[i] = Guid.Empty;
        }
        RoomData.ManWorkingStates = RoomDefData.ManWorkingStates;
        RoomData.CoveredIndizes   = GridManager.Ref.GetOccupiedindizes(roomSize, leftMostIndex);

        CreateRoom(RoomData);
    }
示例#5
0
 private void InitiateBuilding(Enums.RoomSizes RoomSize, Enums.RoomTypes RoomType, Enums.RoomOverUnder RoomOverUnder = Enums.RoomOverUnder.Neutral)
 {
     StateManager.Ref.SetGameState(Enums.GameStates.BuildRoom);
     GridIndex[] BuildingIndexArray = GridManager.Ref.GetPossibleBuildingindizes(RoomSize);
     BuildManager.Ref.ShowRoomPositionSelectors(BuildingIndexArray, RoomType, RoomSize, RoomOverUnder);
 }
示例#6
0
    public RoomDefData GetRoomDefData(Enums.RoomTypes roomType, Enums.RoomSizes roomSize, Enums.RoomOverUnder roomOverUnder)
    {
        foreach (RoomDefData DefData in Constants.RoomDefinitions)
        {
            if ((DefData.RoomType == roomType) && (DefData.RoomSize == roomSize) && (DefData.RoomOverUnder == roomOverUnder))
            {
                return(DefData);
            }
        }

        Debug.Assert(1 == 0);
        return(Constants.RoomDefinitions[0]);
    }
示例#7
0
 public void Build_Finished(Enums.RoomSizes roomSize, Enums.RoomTypes roomType, Enums.RoomOverUnder roomOverUnder, GridIndex index)
 {
     HideRoomPositionSelectors();
     RoomManager.Ref.CreateRoom(Guid.NewGuid(), roomType, roomSize, roomOverUnder, index);
 }
示例#8
0
    public void ShowRoomPositionSelectors(GridIndex[] indexArray, Enums.RoomTypes roomType, Enums.RoomSizes roomSize, Enums.RoomOverUnder overUnder)
    {
        if (indexArray == null)
        {
            return;
        }

        if (indexArray.Length == 0)
        {
            StateManager.Ref.SetGameState(Enums.GameStates.Normal);
            GuiManager.Ref.Initiate_UserInfoSmall("Sorry, can't build a room of this type now!");
            return;
        }

        for (int i = 0; i < indexArray.Length; i++)
        {
            Debug.Assert(roomSize != Enums.RoomSizes.None);

            //CHECK TO SEE IF BUILDING IS UNDER/OVERWORLD, SKIP TO NEXT ITERATION IF POSITION IS NOT COMPATIBLE WITH OVERUNDER TYPE
            int yPos = indexArray[i].Y;

            if ((yPos < Constants.GridSurfaceY && (int)overUnder == 1) ||
                (yPos >= Constants.GridSurfaceY && (int)overUnder == -1))
            {
                continue;
            }

            GameObject go = Instantiate(Resources.Load <GameObject>(Constants.RoomBuildSelectorModels[roomSize]));
            Debug.Assert(go != null);

            go.transform.position = GridManager.Ref.GetWorldPositionFromGridIndex(indexArray[i]);

            go.transform.GetComponent <BuildPositionScript>().SetRoomInfoData(roomSize, roomType, overUnder, indexArray[i]);
            go.SetActive(true);

            RoomPositionSelectors.Add(go);
        }
    }