コード例 #1
0
ファイル: Obstacle.cs プロジェクト: ChocMaltHoney/Neuroleptic
 public Obstacle(Obstacle other)
     : base(other)
 {
     UFrameMax = other.UFrameMax;
     VFrameMax = other.VFrameMax;
     FrameWidth = other.FrameWidth;
     FrameHeight = other.FrameHeight;
     Origin = other.Origin;
 }
コード例 #2
0
 public static Room LoadFile(ContentManager Content, String s_File)
 {
     XmlReaderSettings settings = new XmlReaderSettings();
     settings.ConformanceLevel = ConformanceLevel.Fragment;
     settings.IgnoreWhitespace = true;
     settings.IgnoreComments = true;
     Room instance = new Room();
     using (XmlReader XMLReader = XmlReader.Create(s_File, settings))
     {
         //go through the file finding these nodes and loading them
         while (XMLReader.Read())
         {
             if (XMLReader.IsStartElement())
             {
                 switch (XMLReader.Name)
                 {
                     case "Room":
                         //Console.WriteLine("Start <Room> element.");
                         break;
                     case "AnimatedSprite":
                         //Console.WriteLine("Start <AnimatedSprite> element.");
                         instance.RoomBase = new AnimatedSprite();
                         instance.RoomBase.xmlImport(XMLReader, Content);
                         break;
                     case "Weapon":
                         //Console.WriteLine("Start <Weapon> element.");
                         Items.Weapon wpn = new Items.Weapon();
                         wpn.xmlImport(XMLReader, Content);
                         instance.AddItem(wpn);
                         break;
                     case "Psyche":
                         //Console.WriteLine("Start <Psyche> element.");
                         Items.Psyche psy = new Items.Psyche();
                         psy.xmlImport(XMLReader, Content);
                         instance.AddItem(psy);
                         break;
                     case "Player":
                         //Console.WriteLine("Start <Player> element.");
                         Game1.ePlayer = new Entities.Player(Content);
                         Game1.ePlayer.xmlImport(XMLReader, Content);
                         break;
                     case "Enemy":
                         //Console.WriteLine("Start <Enemy> element.");
                         Entities.Enemy eny = new Entities.Enemy();
                         eny.xmlImport(XMLReader, Content);
                         instance.AddEntity(eny);
                         break;
                     case "BasicEnemy":
                         //Console.WriteLine("Start <BasicEnemy> element.");
                         Entities.BasicEnemy bsceny = new Entities.BasicEnemy();
                         bsceny.xmlImport(XMLReader, Content);
                         instance.AddEntity(bsceny);
                         break;
                     case "SpawnerEnemy":
                         //Console.WriteLine("Start <SpawnerEnemy> element.");
                         Entities.SpawnerEnemy swpeny = new Entities.SpawnerEnemy();
                         swpeny.xmlImport(XMLReader, Content);
                         instance.AddEntity(swpeny);
                         break;
                     case "BossEnemy":
                         //Console.WriteLine("Start <BossEnemy> element.");
                         Entities.BossEnemy bosseny = new Entities.BossEnemy();
                         bosseny.xmlImport(XMLReader, Content);
                         instance.AddEntity(bosseny);
                         break;
                     case "Obstacle":
                         //Console.WriteLine("Start <Obstacle> element.");
                         Obstacle obs = new Obstacle();
                         obs.xmlImport(XMLReader, Content);
                         instance.AddObject(obs);
                         break;
                 }
             }
         }
         //Console.WriteLine("End <Room> element.");
     }
     return instance;
 }
コード例 #3
0
ファイル: Room.cs プロジェクト: ChocMaltHoney/Neuroleptic
 public void AddObject(Obstacle as_NewObject)
 {
     lObjects.Add(as_NewObject);
 }