Esempio n. 1
0
 public World()
 {
     StaticData   = WorldDatabase.GetWorldData();
     _worldLevels = new Level[LevelDatabase.LevelCount];
     for (int i = 0; i < _worldLevels.Length; i++)
     {
         _worldLevels[i] = new Level(i + 1);
     }
 }
    /// <summary>
    /// Entry point for populating screen with information from JSON
    /// Based on Current Information Set as dictated by dropdown.
    /// </summary>
    private void PopulateFromJson()
    {
        for (int i = 0; i < InfoContent.childCount; i++)
        {
            Destroy(InfoContent.GetChild(i).gameObject);
        }

        if (_currentInformationSet == InformationSet.WorldInformation)
        {
            _rootObject = WorldDatabase.GetWorldData() ?? Activator.CreateInstance(typeof(WorldData));
        }
        else if (_currentInformationSet == InformationSet.LevelInformation)
        {
            _rootObject = LevelDatabase.GetLevelArrayData() ?? Activator.CreateInstance(typeof(LevelArray));
        }
        else if (_currentInformationSet == InformationSet.RoomInformation)
        {
            _rootObject = RoomDatabase.GetRoomArayData() ?? Activator.CreateInstance(typeof(RoomArray));
        }
        else if (_currentInformationSet == InformationSet.InteractableInformation)
        {
            _rootObject = InteractableDatabase.GetInteractableArray() ?? Activator.CreateInstance(typeof(InteractableArray));
        }
        else if (_currentInformationSet == InformationSet.ObstacleInformation)
        {
            _rootObject = ObstacleDatabase.GetObstacleArray() ?? Activator.CreateInstance(typeof(ObstacleArray));
        }
        else if (_currentInformationSet == InformationSet.ItemInformation)
        {
            _rootObject = ItemDatabase.GetItemArray() ?? Activator.CreateInstance(typeof(ItemArray));
        }
        else if (_currentInformationSet == InformationSet.MessageInformation)
        {
            _rootObject = MessageDatabase.GetMessageData() ?? Activator.CreateInstance(typeof(MessageData));
        }

        PopulateViewGroup(_rootObject, InfoContent);
        MessageUI.text = _currentInformationSet.ToString() + " loaded.";
    }