public virtual void Load(Loader l, Instruction i)
 {
     switch (i.Type)
     {
         case "adn":
             Addons.Add(l.Find(i.String()).Load<AddonTemplate>());
             break;
     }
 }
Beispiel #2
0
 public virtual void Load(Loader l, Instruction i)
 {
     switch (i.Type)
     {
         case "xaml":
             Xaml = l.Find(i.String()).Read();
             break;
     }
 }
 protected virtual void Load(Loader l, Instruction i)
 {
     switch (i.Type)
     {
         case "name":
             Name = i.String();
             break;
     }
 }
Beispiel #4
0
 public virtual void Load(Loader l, Instruction i)
 {
     switch (i.Type)
     {
         case "startup":
             if (i.Bool())
                 Event.Once(typeof(Game), Game.Loaded, (sender, e) => Start());
             break;
         case "once": // TODO: Add flags for game saves (though far, far away...)
             StartOnce = i.Bool();
             break;
         default:
             break;
     }
 }
Beispiel #5
0
 public virtual void Load(Loader l, Instruction i)
 {
     switch (i.Type)
     {
         case "node":
             string id = i.String();
             node = new NodeTemplate(id);
             Nodes[id] = node;
             if (Root == null)
                 Root = node;
             break;
         case "par": // Parent
             Nodes[i.String()].Children.Add(node);
             break;
         case "cent":
             node.Center = i.Point3D();
             break;
         case "axis":
             node.Axis = i.Vector3D();
             break;
     }
 }
Beispiel #6
0
 public virtual void Load(Loader l, Instruction i)
 {
     switch (i.Type)
     {
         case "name":
             Name = i.String();
             break;
         case "dim":
             int width = i.Int(), height = i.Int(), length = i.Int();
             Dimension = new Dimension3D(width, height, length);
             models = new Model[width, height, length];
             break;
         case "m": // Model
             {
                 Position3D pos = i.Position3D();
                 ModelTemplate mt = Game.Get<ModelTemplate>(i.String());
                 Model m = new Model(mt);
                 AddModel(m, pos);
                 ProcessModelArgs(i, m);
             }
             break;
         case "r": // Range (multiple models)
             {
                 Position3D origin = i.Position3D();
                 Dimension3D dim = i.Dimension3D();
                 ModelTemplate mt = Game.Get<ModelTemplate>(i.String());
                 origin.ForEachInRange(dim, (loc) =>
                 {
                     Model m = new Model(mt);
                     AddModel(m, loc);
                 });
             }
             break;
         case "a": // Actor
             {
                 Position3D pos = i.Position3D();
                 ActorTemplate at = Game.Get<ActorTemplate>(i.String());
                 Actor actor = new Actor(at);
                 AddActor(actor);
                 ProcessModelArgs(i, actor);
             }
             break;
         case "dl": // Directional light
             {
                 Light light = new DirectionalLight(i.Color(), i.Vector3D());
                 Lamp ls = new Lamp(light);
                 AddLamp(ls);
                 if (i.HasNext)
                     namedElements[i.String()] = ls;
             }
             break;
         case "pl": // Point light
             {
                 Light light = new PointLight(i.Color(), i.Point3D());
                 Lamp ls = new Lamp(light);
                 AddLamp(ls);
                 if (i.HasNext)
                     namedElements[i.String()] = ls;
             }
             break;
         case "al": // Ambient light
             {
                 Light light = new AmbientLight(i.Color());
                 Lamp ls = new Lamp(light);
                 AddLamp(ls);
                 if (i.HasNext)
                     namedElements[i.String()] = ls;
             }
             break;
     }
 }
Beispiel #7
0
 private void ProcessModelArgs(Instruction i, Model m)
 {
     while (i.HasNext)
     {
         switch (i.String())
         {
             case "-id":
                 namedElements[i.String()] = m;
                 break;
             case "-dir":
                 m.Direction = new Direction(i.Int());
                 break;
         }
     }
 }