本文整理汇总了C#中RoomData.SetEnergyTankById方法的典型用法代码示例。如果您正苦于以下问题:C# RoomData.SetEnergyTankById方法的具体用法?C# RoomData.SetEnergyTankById怎么用?C# RoomData.SetEnergyTankById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RoomData
的用法示例。
在下文中一共展示了RoomData.SetEnergyTankById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromObject
// Parsing
public static RoomData FromObject(JsonData jsonData)
{
RoomData roomData = new RoomData();
int gameID = SessionData.GetInstance().GameID;
int room_x = (int)jsonData["room_x"];
int room_y = (int)jsonData["room_y"];
int room_z = (int)jsonData["room_z"];
float world_x= jsonData["world_x"].IsInt ? (float)((int)jsonData["world_x"]) : (float)((double)jsonData["world_x"]);
float world_y= jsonData["world_y"].IsInt ? (float)((int)jsonData["world_y"]) : (float)((double)jsonData["world_y"]);
float world_z= jsonData["world_z"].IsInt ? (float)((int)jsonData["world_z"]) : (float)((double)jsonData["world_z"]);
roomData.RoomKey.Set(gameID, room_x, room_y, room_z);
roomData.WorldPosition.Set(world_x, world_y, world_z);
roomData.StaticRoomData = StaticRoomData.FromObject(roomData.RoomKey, jsonData["data"]);
{
JsonData portalList = jsonData["portals"];
for (int portalIndex= 0; portalIndex < portalList.Count; portalIndex++)
{
JsonData portalObject = portalList[portalIndex];
RoomPortal portal = RoomPortal.FromObject(portalObject);
roomData.RoomPortals.Add(portal);
}
}
{
JsonData mobObjects = jsonData["mobs"];
roomData.m_mobs = new Dictionary<int, MobData>();
for (int mobIndex= 0; mobIndex < mobObjects.Count; mobIndex++)
{
JsonData mobObject = mobObjects[mobIndex];
MobData mobData = MobData.FromObject(mobObject);
roomData.SetMobById(mobData.mob_id, mobData);
}
}
{
JsonData energyTankObjects = jsonData["energyTanks"];
roomData.m_energyTanks = new Dictionary<int, EnergyTankData>();
for (int energyTankIndex = 0; energyTankIndex < energyTankObjects.Count; energyTankIndex++)
{
JsonData energyTankObject = energyTankObjects[energyTankIndex];
EnergyTankData energyTankData = EnergyTankData.FromObject(energyTankObject);
roomData.SetEnergyTankById(energyTankData.energy_tank_id, energyTankData);
}
}
return roomData;
}