public GameObjectItem(Vector2 position) : base() { Position = position; Rotation = 0; Scale = Vector2.One; Components = new ComponentItemCollection(); // Load icon for game object. _icon = Game1.Instance.Content.Load <Texture2D>("icon_gameobject"); OnTransformed(); }
/// <summary> /// Called by Level.FromFile(filename) on each Item after the deserialization process. /// Loads all assets needed by the TextureItem, especially the Texture2D. /// You must provide your own implementation. However, you can rely on all public fields being /// filled by the level deserialization process. /// </summary> public override void load(ContentManager cm) { _icon = cm.Load <Texture2D>("icon_gameobject"); if (Components == null) { Components = new ComponentItemCollection(); } foreach (var c in Components) { foreach (var selectable in c.GetSelectables()) { selectable.gameObject = this; } } Scene.GameObjectNames.Add(Name); OnTransformed(); }
public ComponentCollectionPropertyDescriptor(ComponentItemCollection coll, int idx) : base("#" + idx.ToString(), null) { this.collection = coll; this.index = idx; }