PlayerData CreatePlayerData() { bool newPlayer = true; string profileID = "01"; DateTime dateCreated = DateTime.UtcNow; string versionCreated = "0."; int secondsPlayed = 0; int secondsSinceLastDeath = 0; float health = 20; float foodLevel = 20; float foodSaturationLevel = 20; float foodExhaustionLevel = 20; float sleepLevel = 20; float sleepTickTimer = 100; bool isCreative = true; float exp = 0; PlayerData.Vector3Ser originalSpawnLocation = new PlayerData.Vector3Ser(0, 0, 0); PlayerData.Vector3Ser currentSpawnLocation = originalSpawnLocation; bool useOriginalSpawnLocation = true; PlayerData.Vector3Ser currentLocation = currentSpawnLocation; bool isDead = false; List <PlayerData.Vector3IntSer> previousDeaths = new List <PlayerData.Vector3IntSer>(); List <InventorySlot> inventorySlots = new List <InventorySlot>(32); for (int i = 0; i < inventorySlots.Capacity; i++) { inventorySlots.Add(new InventorySlot(i + 1, (i + 1) * 2)); } PlayerData playerData = new PlayerData(newPlayer, profileID, dateCreated, versionCreated, secondsPlayed, secondsSinceLastDeath, health, foodLevel, foodSaturationLevel, foodExhaustionLevel, sleepLevel, sleepTickTimer, isCreative, exp, originalSpawnLocation, currentSpawnLocation, useOriginalSpawnLocation, currentLocation, isDead, inventorySlots, previousDeaths); return(playerData); }
public PlayerData GetPlayerData() { PlayerData.Vector3Ser originalSpawnLocation = new PlayerData.Vector3Ser(this.originalSpawnLocation.x, this.originalSpawnLocation.y, this.originalSpawnLocation.z); PlayerData.Vector3Ser currentSpawnLocation = new PlayerData.Vector3Ser(this.currentSpawnLocation.x, this.currentSpawnLocation.y, this.currentSpawnLocation.z); PlayerData.Vector3Ser currentLocation = new PlayerData.Vector3Ser(this.currentLocation.x, this.currentLocation.y, this.currentLocation.z); List <PlayerData.Vector3IntSer> previousDeaths = new List <PlayerData.Vector3IntSer>(); for (int i = 0; i < this.previousDeaths.Count; i++) { previousDeaths.Add(new PlayerData.Vector3IntSer(this.previousDeaths[i].x, this.previousDeaths[i].y, this.previousDeaths[i].z)); } PlayerData playerData = new PlayerData(newProfile, profileID, dateCreated, versionCreated, secondsPlayed, secondsSinceLastDeath, health, foodLevel, foodSaturationLevel, foodExhaustionLevel, sleepLevel, sleepTickTimer, isCreative, exp, originalSpawnLocation, currentSpawnLocation, useOriginalSpawnLocation, currentLocation, isDead, inventorySlot, previousDeaths); return(playerData); }