public static QuestLog FromJson(string json) { SerializeableQuestLog myClone = UnityEngine.JsonUtility.FromJson <SerializeableQuestLog>(json); QuestLog questlog = new QuestLog { }; questlog.Initialize(myClone.quests.Length); for (int i = 0; i < myClone.quests.Length; i++) { questlog.quests[i] = myClone.quests[i]; } return(questlog); }
public void GiveQuestToPlayers() { if (quest != null) { foreach (var player in sys.playerSystemGroup.playerSpawnSystem.controllers.Values) { QuestLog questlog = EntityManager.GetComponentData <QuestLog>(player); System.Collections.Generic.List <QuestDatam> quests = new System.Collections.Generic.List <QuestDatam>(); quests.Add(quest); questlog.Initialize(quests); EntityManager.SetComponentData(player, questlog); } } }
private void SetPlayerCharacter(Entity entity, int id, Entity world, int metaID, float3 position) { CharacterDatam characterDatam = meta[metaID]; var voxelDimensions = new int3(16, 64, 16); if (worldSpawnSystem != null) { voxelDimensions = World.EntityManager.GetComponentData <Voxels.World>(world).voxelDimensions; } Inventory inventory = new Inventory { }; inventory.InitializeItems(9, characterDatam.items); World.EntityManager.SetComponentData(entity, inventory); QuestLog questlog = new QuestLog { }; questlog.Initialize(characterDatam.quests); World.EntityManager.SetComponentData(entity, questlog); World.EntityManager.SetComponentData(entity, new ItemHitTaker { radius = characterDatam.itemPickupRadius }); StatbarSystem.SpawnPlayerStatbar(World.EntityManager, entity); ActionbarSystem.SpawnUI(World.EntityManager, entity); CrosshairSpawnSystem.SpawnUI(World.EntityManager, entity); World.EntityManager.SetComponentData(entity, new ChunkStreamPoint { world = world, voxelDimensions = voxelDimensions, didUpdate = 1, chunkPosition = VoxelRaycastSystem.GetChunkPosition(new int3(position), voxelDimensions) }); }