Esempio n. 1
0
 protected override void Initialize()
 {
     GameState gs = new GameState();
     Layer3D l = new Layer3D();
     #if !DEBUG
     l.AddComponent(new Origin(5));
     #endif
     l.AddComponent(this.mr = new ModelRenderer("suzanne", Vector3.Zero, Vector3.Zero, 2));
     gs.AddComponent(l);
     PushState(gs);
 }
Esempio n. 2
0
        public Editor(GameState editing)
        {
            this.Editing = editing;
            this.Editing.HandleMessage(Messages.MapReset, null);
            if (Editing.Camera != null)
                this.Editing.Camera.HandleMessage(Messages.CameraStopFollowing, null);

            layers = new List<EditorLayer>();
            foreach (Component c in editing.Components)
            {
                if (c.Properties != null && c.Properties.GetString("editable", null) != null)
                {
                    string name = c.Properties.GetString("editable", null);
                    layers.Add(new EditorLayer(c, name + " (Properties)", LayerType.Properties));
                    if (c is EntityLayer)
                    {
                        if (MapLoader.TileList != null && c.Properties.GetBoolean("tiles", false))
                            layers.Add(new EditorLayer(c, name + " (Tiles)", LayerType.Tiles));
                        if (MapLoader.EntityList != null && c.Properties.GetBoolean("entities", false))
                            layers.Add(new EditorLayer(c, name + " (Entities)", LayerType.Entities));
                    }
                }

            }

            if (layers.Count > 0)
            {
                currentLayer = 0;
                for (int i = 0; i < layers.Count; i++)
                {
                    if (layers[i].Type != LayerType.Properties)
                    {
                        currentLayer = i;
                        break;
                    }
                }
            }
            ChangeLayer();

            CreateWindows();
        }
Esempio n. 3
0
 public override void OnAncestryChanged()
 {
     base.OnAncestryChanged();
     this.gameState = this.GetAncestor<GameState>();
     if( this.gameState != null )
         this.input = this.gameState.Input;
 }
Esempio n. 4
0
 public EditorState(GameState editing)
 {
     this.Propagate = false;
     this.Transparent = true;
     renderer = new Renderer(1, Renderer.ViewportPolicy.Fit, Renderer.RenderOptions.Canvas);
     Editor = new Editor(editing);
     AddComponent(Editor);
     AddComponent(renderer);
 }