public FireballClass() { animatedMapDataD = ResourceCache.Instance.GetAnimatedTexture("fireball.amd"); animatedMapDataN = ResourceCache.Instance.GetAnimatedTexture("fireball_bump.amd"); name = "Kula ognia"; this.gameTeam = GameTeam.Assassins; this.pickupRD = ResourceCache.Instance.GetRenderingData("fireball.x"); this.missileRD = ResourceCache.Instance.GetRenderingData("fireball.x"); this.cameraRD = ResourceCache.Instance.GetRenderingData("handWithFireball.x"); this.weaponType = WeaponType.Ranged; this.weaponParams = new WeaponInfo(100, 0.5f, 100); this.flyingObjectParameters = new CastleButcher.GameEngine.PlayerMovementParameters(0, 200); this.collisionDataType = Framework.Physics.CollisionDataType.CollisionSphere; this.collisionData = new CollisionSphere(4); this.ammoInBox = 5; this.pickupReuseTime = 2; MapAnimation animD = animatedMapDataD.GetAnimationInstance(); animD.Start(); animD.Loop = true; MapAnimation animN = animatedMapDataN.GetAnimationInstance(); animN.Start(); animN.Loop = true; missileRD.MeshMaterials[0] = new MaterialData(animD, animN, null, new Microsoft.DirectX.Direct3D.Material()); cameraRD.MeshMaterials[4] = missileRD.MeshMaterials[0]; GM.AppWindow.AddUpdateableItem(animD as IUpdateable); GM.AppWindow.AddUpdateableItem(animN as IUpdateable); }
public static AnimatedMapData FromFile(string fileName) { AnimatedMapData data = new AnimatedMapData(); data.fileName = fileName; XmlTextReader reader = new XmlTextReader(fileName); string result; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "AnimatedMapData") { List<Texture> textures=new List<Texture>(); while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.Name == "AnimationData") { result = reader.GetAttribute("duration"); if (result == null) throw new FileFormatException("Nie znaleziono atrybutu duration w " + fileName); NumberFormatInfo nfi = new NumberFormatInfo(); nfi.NumberDecimalSeparator = "."; data.duration = float.Parse(result, nfi); result = reader.GetAttribute("loop"); if (result == null) throw new FileFormatException("Nie znaleziono atrybutu loop w " + fileName); if (result=="true") { data.loop = true; } else if (result == "false") { data.loop = false; } else { throw new Exception("Atrybut loop nie ma poprawnego formatu " + fileName); } } else if (reader.Name == "MapFile") { result = reader.GetAttribute("file"); if (result == null) throw new FileFormatException("Nie znaleziono atrybutu MapFile w " + fileName); textures.Add(ResourceCache.Instance.GetDxTexture(result)); } } data.DxTextures = textures.ToArray(); return data; } } return null; }
public MapAnimation(AnimatedMapData map,float duration,bool loop) { this.map = map; this.duration = duration; this.Loop = loop; }