Example #1
0
    public void RegisterRoomObjectGO(RoomObjectGO roomObjectGO)
    {
        bool exists = RoomObjectGOs.Any(go => go.RoomObjectBlueprint.RoomObjectName == roomObjectGO.RoomObjectBlueprint.RoomObjectName);

        //Logger.Log("Registered a {0} object in {1}", roomObjectGO.RoomObject.RoomObjectName, roomObjectGO.ParentRoom.RoomBlueprint.RoomName);
        RoomObjectGOs.Add(roomObjectGO);

        // if first of its kind, check if we should register a new routine
        if (!exists)
        {
            for (int i = 0; i < roomObjectGO.RoomObjectBlueprint.CharacterRoutines.Length; i++)
            {
                CharacterRoutineType routineType = roomObjectGO.RoomObjectBlueprint.CharacterRoutines[i];
                if (!RoutineManager.AvailableRoutineTypes.ContainsKey(routineType.Name))
                {
                    RoutineManager.EnableRoutineType(routineType);
                }
            }
        }
    }