private void LoadPlaceableRoomObjects()
    {
        for (int i = 0; i < RegisteredPlaceableRoomObjects.Count; i++)
        {
            RoomObjectName roomObjectName = RegisteredPlaceableRoomObjects[i];
            Dictionary <ObjectRotation, GameObject> RoomObjectPrefabs = new Dictionary <ObjectRotation, GameObject>();

            foreach (ObjectRotation rotation in ObjectRotation.GetValues(typeof(ObjectRotation)))
            {
                GameObject roomObjectPrefab = (GameObject)Resources.Load("Prefabs/Scenery/RoomObjects/" + roomObjectName + "/" + roomObjectName + rotation, typeof(GameObject));
                if (roomObjectPrefab != null)
                {
                    RoomObjectPrefabs.Add(rotation, roomObjectPrefab);
                }
            }

            PlaceableRoomObjectPrefabs.Add(roomObjectName, RoomObjectPrefabs);
        }
    }
Exemplo n.º 2
0
    public void DeregisterRoomObjectGO(RoomObjectGO roomObjectGO)
    {
        RoomObjectGOs.Remove(roomObjectGO);

        // if room object last of its kind, check if we should deregister a routine
        bool exists = RoomObjectGOs.Any(go => go.RoomObjectBlueprint.RoomObjectName == roomObjectGO.RoomObjectBlueprint.RoomObjectName);

        List <CharacterRoutineType> noLongerAvailableRoutines = new List <CharacterRoutineType>();

        if (!exists)
        {
            for (int i = 0; i < RoutineManager.AvailableRoutineTypes.Count; i++)
            {
                CharacterRoutineType characterRoutineType = RoutineManager.AvailableRoutineTypes.ElementAt(i).Value;
                bool containsRoomObject = characterRoutineType.RoomObjects.Contains(roomObjectGO.RoomObjectBlueprint.RoomObjectName);
                bool isStillAvailable   = false;

                if (containsRoomObject)
                {
                    for (int j = 0; j < characterRoutineType.RoomObjects.Count; j++)
                    {
                        RoomObjectName roomObjectInRoutine = characterRoutineType.RoomObjects[j];
                        if (RoomObjectGOs.Any(go => go.RoomObjectBlueprint.RoomObjectName == roomObjectInRoutine))
                        {
                            isStillAvailable = true;
                            break;
                        }
                    }
                }
                if (isStillAvailable)
                {
                    noLongerAvailableRoutines.Add(characterRoutineType);
                }
            }

            for (int k = 0; k < noLongerAvailableRoutines.Count; k++)
            {
                RoutineManager.DisableRoutineType(noLongerAvailableRoutines[k]);
            }
        }
    }
Exemplo n.º 3
0
    public static RoomObjectBlueprint Create(RoomObjectName roomObjectName)
    {
        switch (roomObjectName)
        {
        case RoomObjectName.Guitar:
            return(GuitarBlueprint());

        case RoomObjectName.Piano:
            return(PianoBlueprint());

        case RoomObjectName.ControlRoomMicrophone:
            return(ControlRoomMicrophoneBlueprint());

        case RoomObjectName.MixPanel:
            return(MixPanelBlueprint());

        case RoomObjectName.Telephone:
            return(TelephoneBlueprint());

        default:
            Logger.Error("Cannot find a creation function for blueprint {0}", roomObjectName);
            return(null);
        }
    }
Exemplo n.º 4
0
 private RoomObjectBlueprint(RoomObjectName roomObjectName)
 {
     RoomObjectName = roomObjectName;
     Price          = -1;
 }