コード例 #1
0
        //FIXME: More to come
        public Sector(Parser parser)
        {
            this.tilemaps = new List<Tilemap>();
            this.gameObjects = new List<GameObject>();

            int d = parser.Depth;
            while (parser.Parse() && parser.Depth >= d) {
                if (parser.Depth == d + 1) {
                    if (parser.Type != Parser.LispType.SYMBOL)
                        throw new Exception("expected SYMBOL");
                    string symbol = parser.SymbolValue;
                    parser.Parse();
                    switch (symbol) {
                        case "name":
                            this.name = parser.StringValue;
                            break;
                        case "music":
                            this.music = parser.StringValue;
                            break;
                        case "gravity":
                            this.gravity = parser.FloatValue;
                            break;
                        case "tilemap":
                            this.tilemaps.Add(new Tilemap(parser));
                            break;
                        case "background":
                            this.background = new Background(parser);
                            break;
                        default:
                            //this.gameObjects.Add(new GameObject(symbol, parser));
                            this.gameObjects.Add(GameObject.Parse(symbol, parser));
                            //Console.WriteLine("WARNING: Unknown tile element " + symbol + ", skipping");
                            //SkipList(parser);
                            break;
                    }
                }
            }
        }
コード例 #2
0
 public Sector(string name)
 {
     this.name = name;
     this.music = "music/chipdisko.ogg";
     this.gravity = 10.0F;
     this.tilemaps = new List<Tilemap>();
     this.tilemaps.Add(new Tilemap(-100, false, 310, 19));
     this.tilemaps.Add(new Tilemap(0, true, 310, 19));
     this.tilemaps.Add(new Tilemap(100, false, 310, 19));
     this.background = new Background("images/background/arctis.jpg", 0.5F);
     this.gameObjects = new List<GameObject>();
     this.gameObjects.Add(new Spawnpoint("main", 100, 100));
 }