SadConsoleEditor.Editors.GameObjectEditor.SetEntity C# (CSharp) Method

SetEntity() public method

public SetEntity ( GameObject entity ) : void
entity GameObject
return void
        public void SetEntity(GameObject entity)
        {
            gameObject = entity;
            gameObject.Font = SadConsoleEditor.Settings.Config.ScreenFont;

            if (!gameObject.Animations.ContainsValue(gameObject.Animation))
                gameObject.Animation = gameObject.Animations.First().Value;

            animationPanel.SetEntity(gameObject);
            gameObjectNamePanel.SetEntity(gameObject);
            Title = entity.Name;

            SelectedAnimationChanged(gameObject.Animation);
        }

Usage Example

Example #1
0
        public bool LoadEntity(GameObject entity)
        {
            var editor = new GameObjectEditor();

            editor.SetEntity(entity);
            editor.LinkedEditor = this;
            MainScreen.Instance.AddEditor(editor, false);

            var localEntity = new GameObject(entity.Animation);

            foreach (var item in entity.Animations.Values)
            {
                localEntity.Animations[item.Name] = item;
            }

            Objects.Add(new ResizableObject(ResizableObject.ObjectType.GameObject, localEntity));
            GameObjectPanel.RebuildListBox();

            localEntity.Position = entity.Position;

            LinkedGameObjects.Add(localEntity, entity);

            FixLinkedObjectTitles();
            return(true);
        }
All Usage Examples Of SadConsoleEditor.Editors.GameObjectEditor::SetEntity