/// <summary> /// Create and return a GameObject with skybox attached to it. /// </summary> /// <param name="texture">Skybox texture (leave null for default texture).</param> /// <param name="parent">Optional GameObject to attach add skybox to (as a child). If null, will add to active scene's root.</param> /// <returns>GameObject containing skybox.</returns> public ECS.GameObject CreateSkybox(string texture = null, ECS.GameObject parent = null) { ECS.GameObject skybox = new ECS.GameObject("skybox", ECS.SceneNodeType.Simple); skybox.AddComponent(new ECS.Components.Graphics.SkyBox(texture)); skybox.Parent = parent != null ? parent : Application.Instance.ActiveScene.Root; return(skybox); }
/// <summary> /// Create and return a GameObject with background attached to it. /// Note: also attach it to either the active scene root, or a given GameObject. /// </summary> /// <param name="texture">Skybox texture (leave null for default texture).</param> /// <param name="parent">Optional GameObject to attach add skybox to (as a child). If null, will add to active scene's root.</param> /// <returns>GameObject containing background.</returns> public ECS.GameObject CreateBackground(string texture, ECS.GameObject parent = null) { ECS.GameObject background = new ECS.GameObject("background", ECS.SceneNodeType.Simple); background.AddComponent(new ECS.Components.Graphics.SceneBackground(texture)); background.Parent = parent != null ? parent : Application.Instance.ActiveScene.Root; return(background); }
/// <summary> /// Init application manager. /// </summary> public void Initialize() { // create empty scene with starting test camera ActiveScene = new ECS.GameScene(); ECS.GameObject camera = new ECS.GameObject("camera", ECS.SceneNodeType.Simple); camera.AddComponent(new ECS.Components.Graphics.Camera()); camera.SceneNode.Position = new Vector3(0, 0, 10); }