public static ShaderInfo LoadShader(LevelTags tags) { var shaderInfo = new ShaderInfo(); var sizeList = tags.GetTag <int[]>("Size"); shaderInfo.Size = new Vector3(sizeList[0], 1, sizeList[1]); if (sizeList.Length == 3) { shaderInfo.Size = new Vector3(sizeList[0], sizeList[1], sizeList[2]); } var shaderList = tags.GetTag <float[]>("Shader"); shaderInfo.Shader = new Vector3(shaderList[0], shaderList[1], shaderList[2]); shaderInfo.StopOnContact = tags.GetTag <bool>("StopOnContact"); var posList = tags.GetTag <int[]>("Position"); shaderInfo.Position = new Vector3(posList[0], posList[1], posList[2]); var objectSizeList = tags.GetTag <int[]>("Size"); shaderInfo.ObjectSize = new Size(objectSizeList[0], objectSizeList[1]); if (tags.TagExists("DayTime")) { shaderInfo.DayTime = tags.GetTag <int[]>("DayTime"); } return(shaderInfo); }
public static EntityNPCInfo LoadNpc(LevelTags tags) { var npcInfo = new EntityNPCInfo(); var posList = tags.GetTag <float[]>("Position"); npcInfo.Position = new Vector3(posList[0], posList[1], posList[2]); if (tags.TagExists("Scale")) { var scaleList = tags.GetTag <float[]>("Scale"); npcInfo.Scale = new Vector3(scaleList[0], scaleList[1], scaleList[2]); } npcInfo.TextureID = tags.GetTag <string>("TextureID"); npcInfo.FaceRotation = tags.GetTag <int>("Rotation"); npcInfo.ActionValue = tags.GetTag <int>("Action"); npcInfo.AdditionalValue = tags.GetTag <string>("AdditionalValue"); npcInfo.Name = tags.GetTag <string>("Name"); npcInfo.ID = tags.GetTag <int>("ID"); npcInfo.Movement = tags.GetTag <string>("Movement"); npcInfo.MoveRectangles = tags.GetTag <Microsoft.Xna.Framework.Rectangle[]>("MoveRectangles"); if (tags.TagExists("Shader")) { var shaderList = tags.GetTag <float[]>("Shader"); npcInfo.Shader = new Microsoft.Xna.Framework.Color(shaderList[0], shaderList[1], shaderList[2]); } if (tags.TagExists("AnimateIdle")) { npcInfo.AnimateIdle = tags.GetTag <bool>("AnimateIdle"); } return(npcInfo); }
public static IList <EntityFloorInfo> LoadFloor(LevelTags tags) { var floorInfo = new EntityFloorInfo(); var list = new List <EntityFloorInfo>(); var sizeList = tags.GetTag <int[]>("Size"); floorInfo.Size = new Size(sizeList[0], sizeList[1]); var posList = tags.GetTag <int[]>("Position"); floorInfo.Position = new Vector3(posList[0], posList[1], posList[2]); floorInfo.TexturePath = tags.GetTag <string>("TexturePath"); floorInfo.TextureRectangles = new [] { tags.GetTag <Microsoft.Xna.Framework.Rectangle>("Texture") }; if (tags.TagExists("Visible")) { floorInfo.Visible = tags.GetTag <bool>("Visible"); } if (tags.TagExists("Shader")) { var shaderList = tags.GetTag <float[]>("Shader"); floorInfo.Shader = new Microsoft.Xna.Framework.Color(shaderList[0], shaderList[1], shaderList[2]); } if (tags.TagExists("Remove")) { floorInfo.RemoveFloor = tags.GetTag <bool>("Remove"); } if (tags.TagExists("hasSnow")) { floorInfo.HasSnow = tags.GetTag <bool>("hasSnow"); } if (tags.TagExists("hasSand")) { floorInfo.HasSand = tags.GetTag <bool>("hasSand"); } if (tags.TagExists("isIce")) { floorInfo.HasIce = tags.GetTag <bool>("isIce"); } if (tags.TagExists("Rotation")) { var rotation = tags.GetTag <int>("Rotation"); // TODO /* * switch (rotation) * { * case 0: * floorInfo.Rotation.Y = 0; * break; * * case 1: * floorInfo.Rotation.Y = MathHelper.PiOver2; * break; * * case 2: * floorInfo.Rotation.Y = MathHelper.Pi; * break; * * case 3: * floorInfo.Rotation.Y = MathHelper.Pi * 1.5F; * break; * } */ } if (tags.TagExists("SeasonTexture")) { floorInfo.SeasonTexture = tags.GetTag <string>("SeasonTexture"); } if (floorInfo.Size.Width > 0 || floorInfo.Size.Height > 0) { for (int x = 0; x < floorInfo.Size.Width; x++) { for (int z = 0; z < floorInfo.Size.Height; z++) { var ent1 = floorInfo.ShallowCopy(); ent1.Position += new Vector3(x, 0, z); list.Add((EntityFloorInfo)ent1); } } } else { list.Add(floorInfo); } return(list); }