SadConsoleEditor.Editors.SceneEditor.LoadEntity C# (CSharp) Method

LoadEntity() public method

public LoadEntity ( GameObject entity ) : bool
entity SadConsole.Game.GameObject
return bool
        public bool LoadEntity(GameObject entity)
        {
            var editor = new GameObjectEditor();
            editor.SetEntity(entity);
            editor.LinkedEditor = this;
            EditorConsoleManager.AddEditor(editor, false);

            var localEntity = new GameObject(entity.Font);

            foreach (var item in entity.Animations.Values)
                localEntity.Animations.Add(item.Name, item);

            localEntity.Animation = localEntity.Animations[entity.Animation.Name];

            localEntity.RenderOffset = consoleWrapper.Position;
            Objects.Add(new ResizableObject(ResizableObject.ObjectType.GameObject, localEntity));
            GameObjectPanel.RebuildListBox();

            localEntity.Position = entity.Position;
            localEntity.RenderOffset = consoleWrapper.Position - consoleWrapper.TextSurface.RenderArea.Location;

            LinkedGameObjects.Add(localEntity, entity);

            FixLinkedObjectTitles();
            return true;
        }