コード例 #1
0
        public override async ETTask Run(EventType.AfterCreateZoneScene args)
        {
            Scene zoneScene = args.ZoneScene;

            zoneScene.AddComponent <ResourcesComponent>();
            zoneScene.AddComponent <UIComponent>();
        }
コード例 #2
0
ファイル: RobotSceneFactory.cs プロジェクト: zwinter/ET
        public static async ETTask <Scene> Create(
            Entity parent,
            long id,
            long instanceId,
            int zone,
            string name,
            SceneType sceneType,
            StartSceneConfig startSceneConfig = null
            )
        {
            await ETTask.CompletedTask;

            Log.Info($"create scene: {sceneType} {name} {zone}");
            Scene scene = EntitySceneFactory.CreateScene(id, instanceId, zone, sceneType, name, parent);

            scene.AddComponent <MailBoxComponent, MailboxType>(MailboxType.UnOrderMessageDispatcher);

            switch (scene.SceneType)
            {
            case SceneType.Robot:
                scene.AddComponent <RobotManagerComponent>();
                break;
            }

            return(scene);
        }
コード例 #3
0
        protected override void Run(EventType.AfterCreateCurrentScene args)
        {
            Scene currentScene = args.CurrentScene;

            currentScene.AddComponent <UIComponent>();
            currentScene.AddComponent <ResourcesLoaderComponent>();
        }
コード例 #4
0
ファイル: SceneChangeHelper.cs プロジェクト: 526077247/ET
        // 场景切换协程
        public static async ETTask SceneChangeTo(Scene zoneScene, string sceneName, long sceneInstanceId)
        {
            // zoneScene.RemoveComponent<AIComponent>();
            zoneScene.AddComponent <KeyCodeComponent>();
            CurrentScenesComponent currentScenesComponent = zoneScene.GetComponent <CurrentScenesComponent>();

            currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的
            Scene currentScene = SceneFactory.CreateCurrentScene(sceneInstanceId, zoneScene.Zone, sceneName, currentScenesComponent);

            currentScene.AddComponent <UnitComponent>();
            currentScene.AddComponent <AOISceneComponent, int>(6);
            // 可以订阅这个事件中创建Loading界面
            using (ListComponent <ETTask> tasks = ListComponent <ETTask> .Create())
            {
                tasks.Add(WaitChangeScene(zoneScene, sceneName)); //等收到消息并且地图创建完成
                tasks.Add(WaitCreateMyUnit(zoneScene));           // 等待CreateMyUnit的消息
                await ETTaskHelper.WaitAll(tasks);
            }
            M2C_CreateMyUnit m2CCreateMyUnit = waitCreateMyUnit.Message;

            UnitFactory.Create(currentScene, m2CCreateMyUnit.Unit);
            // zoneScene.AddComponent<AIComponent,int>(1);

            await Game.EventSystem.PublishAsync(new EventType.SceneChangeFinish()
            {
                ZoneScene = zoneScene, CurrentScene = currentScene
            });

            // 通知等待场景切换的协程
            zoneScene.GetComponent <ObjectWait>().Notify(new WaitType.Wait_SceneChangeFinish());
        }
コード例 #5
0
        public static Scene MainMenu(Point location, Point buttonSize, int buttonPadding)
        {
            Scene mainMenu = new Scene("MainMenu");

            Point buttonPos = location;

            UILabel title = new UILabel();

            title.Text               = "Radiance";
            title.FontSize           = 72;
            title.Color              = Color.White;
            title.RectTransform.Rect = new Rectangle(50, 50, 1000, 150);

            UIButton playButton = new UIButton();

            playButton.Color                   = new Color(0f, 0f, 0f, 0.3f);
            playButton.TextColor               = Color.White;
            playButton.Text                    = "Play";
            playButton.RectTransform.Size      = new Vector2(buttonSize.X, buttonSize.Y);
            playButton.Transform.LocalPosition = new Vector3(buttonPos.X, buttonPos.Y, 0);
            buttonPos.Y += buttonSize.Y + buttonPadding;

            playButton.OnClick += _ => SceneManager.SetActiveScene("MainScene");

            UIPanel optOverlay = new UIPanel();

            optOverlay.Color = new Color(0f, 0f, 0f, 0.3f);
            optOverlay.RectTransform.Rect = new Rectangle(0, 0, 1280, 720);
            optOverlay.Active             = false;

            UIButton optButton = new UIButton();

            optButton.Color                   = new Color(0f, 0f, 0f, 0.3f);
            optButton.TextColor               = Color.White;
            optButton.Text                    = "Settings";
            optButton.RectTransform.Size      = new Vector2(buttonSize.X, buttonSize.Y);
            optButton.Transform.LocalPosition = new Vector3(buttonPos.X, buttonPos.Y, 0);
            buttonPos.Y += buttonSize.Y + buttonPadding;

            optButton.OnClick += _ => optOverlay.Active = !optOverlay.Active;

            UIButton quitButton = new UIButton();

            quitButton.Color                   = new Color(0f, 0f, 0f, 0.3f);
            quitButton.TextColor               = Color.White;
            quitButton.Text                    = "Quit";
            quitButton.RectTransform.Size      = new Vector2(buttonSize.X, buttonSize.Y);
            quitButton.Transform.LocalPosition = new Vector3(buttonPos.X, buttonPos.Y, 0);
            buttonPos.Y += buttonSize.Y + buttonPadding;

            quitButton.OnClick += _ => Game1.Instance.Exit();

            mainMenu.AddComponent(title);
            mainMenu.AddComponent(playButton);
            mainMenu.AddComponent(optOverlay);
            mainMenu.AddComponent(optButton);
            mainMenu.AddComponent(quitButton);

            return(mainMenu);
        }
コード例 #6
0
 protected override async ETTask Run(Scene scene, EventType.AfterCreateClientScene args)
 {
     scene.AddComponent <UIEventComponent>();
     scene.AddComponent <UIComponent>();
     scene.AddComponent <ResourcesLoaderComponent>();
     await ETTask.CompletedTask;
 }
コード例 #7
0
ファイル: Example.cs プロジェクト: Scellow/sfml-ui
        public void Run()
        {
            window = new RenderWindow(new VideoMode(800, 480), "sfml-ui Examples", Styles.Default);
            window.Closed += window_OnCloseRequest;
            window.Resized += window_Resized;

            uimanager = new UISceneManager();
            uimanager.Init(window);

            scene1 = new Scene(ScrollInputs.None);
            scene1.Size = new Vector2f(window.Size.X, window.Size.Y);
            scene1.AddComponent(new TextControl(new Font("font.ttf"), 50) { Size = new Vector2f(800, 100), Color = Color.White, Text = "Hello World", TextAlignment = Alignment.MiddleCenter, Anchor = AnchorPoints.Left | AnchorPoints.Right | AnchorPoints.Top, BackgroundColor = Colors.SteelBlue });
            scene1.AddComponent(new TextControl(new Font("font.ttf"), 16) { Size = new Vector2f(600, 100), Position = new Vector2f(100, 150), Color = Color.Black, Text = "This is an example of sfml-ui, an ui library for SFML.Net", TextAlignment = Alignment.MiddleCenter, Anchor = AnchorPoints.Left | AnchorPoints.Right | AnchorPoints.Top });
            scene1.AddComponent(new PictureControl("example-100.png") { Size = new Vector2f(100, 100), Position = new Vector2f(0, 0), Anchor = AnchorPoints.Left | AnchorPoints.Top });
            scene1.AddComponent(new ButtonControl(new Font("font.ttf"), 16, "button.png", "button_hover.png", "button_pressed.png") { Size = new Vector2f(150, 49), Position = new Vector2f(50, 250), Anchor = AnchorPoints.Left | AnchorPoints.Top, Text = "Press Me :)" });

            uimanager.CurrentScene = scene1;

            while (window.IsOpen())
            {
                window.DispatchEvents();
                window.Clear(Colors.WhiteSmoke);

                uimanager.Render(window);

                window.Display();
            }
        }
コード例 #8
0
ファイル: SceneExtensions.cs プロジェクト: joffarex/AcidarX
        public static void AddSprite
            (this Scene scene, TransformComponent transformComponent, SpriteRendererComponent spriteRendererComponent)
        {
            int entity = scene.CreateEntity();

            scene.AddComponent(entity, transformComponent);
            scene.AddComponent(entity, spriteRendererComponent);
        }
コード例 #9
0
        protected override async ETTask Run(EventType.AfterCreateZoneScene args)
        {
            Scene zoneScene = args.ZoneScene;

            zoneScene.AddComponent <ResourcesComponent>();
            zoneScene.AddComponent <UIComponent>();
            await ETTask.CompletedTask;
        }
コード例 #10
0
        protected override void Run(EventType.AfterCreateZoneScene args)
        {
            Scene zoneScene = args.ZoneScene;

            zoneScene.AddComponent <UIEventComponent>();
            zoneScene.AddComponent <UIComponent>();
            zoneScene.AddComponent <ResourcesLoaderComponent>();
        }
コード例 #11
0
        protected override async ETTask Run(EventType.AfterCreateCurrentScene args)
        {
            Scene currentScene = args.CurrentScene;

            currentScene.AddComponent <UIComponent>();
            currentScene.AddComponent <ResourcesLoaderComponent>();
            await ETTask.CompletedTask;
        }
コード例 #12
0
        protected override async ETTask Run(EventType.AfterCreateZoneScene args)
        {
            Scene zoneScene = args.ZoneScene;

            zoneScene.AddComponent <FUIManagerComponent>();
            zoneScene.AddComponent <FUIPackageManagerComponent>();
            await ETTask.CompletedTask;
        }
コード例 #13
0
ファイル: HouseApp.cs プロジェクト: kaifudeng/ck1
        public void CreateScence()
        {
            Scene scene = new Scene();

            scene.CreateComponent <Octree>();

            //camera
            var cameraNode = scene.CreateChild();

            cameraNode.Position = (new Vector3(0.0f, 0.0f, -8.0f));
            cameraNode.SetDirection(new Vector3(0.1f, 0f, 900f));

            /*string filepath = "D:\\dir.txt";
             * var dir =  cameraNode.Direction;
             * if (!File.Exists(filepath))
             * {
             *  File.Create(filepath).Dispose();
             *  File.WriteAllText(filepath, "X:" + dir.X.ToString() + "Y:" + dir.Y.ToString() + "Z:" + dir.Z.ToString() + "\n");
             * }
             * else
             * {
             *  File.AppendAllText(filepath, "X:" + dir.X.ToString() + "Y:" + dir.Y.ToString() + "Z:" + dir.Z.ToString() + "\n");
             * }*/
            cameraNode.CreateComponent <Camera>();
            Viewport = new Viewport(Context, scene, cameraNode.GetComponent <Camera>(), null);
            if (Platform != Platforms.Android && Platform != Platforms.iOS)
            {
                RenderPath effectRenderPath = Viewport.RenderPath.Clone();
                var        fxaaRp           = ResourceCache.GetXmlFile(Assets.PostProcess.FXAA3);
                effectRenderPath.Append(fxaaRp);
                Viewport.RenderPath = effectRenderPath;
            }
            Renderer.SetViewport(0, Viewport);


            //zone construct- 构造分区
            var zoneNode = scene.CreateChild();
            var zone     = zoneNode.CreateComponent <Zone>();

            zone.SetBoundingBox(new BoundingBox(-300.0f, 300.0f));
            zone.AmbientColor = new Color(1, 1, 1);

            //生成背景
            var backgroud = new Backgroud();

            scene.AddComponent(backgroud);
            backgroud.Start();
            //生成house
            var house = new House();

            scene.AddComponent(house);
            house.Start();
            //生成Apple
            var apple = new Apple();

            scene.AddComponent(apple);
            apple.Start();
        }
コード例 #14
0
        protected override async ETTask Run(EventType.AfterCreateZoneScene args)
        {
            Scene zoneScene = args.ZoneScene;

            zoneScene.AddComponent <UIEventComponent>();
            zoneScene.AddComponent <UIComponent>();
            zoneScene.AddComponent <SessionComponent>();
            zoneScene.AddComponent <LoginComponent>();
            await ETTask.CompletedTask;
        }
コード例 #15
0
ファイル: GameSession.cs プロジェクト: DrShIkIgAmy/PlaneVS
 void RunShip()
 {
     _ship          = new Ship();
     _ship.Position = ShipPosition;
     _ship.Scale    = ShipSize;
     _ship.Rotation = ShipRotation;
     _scene.AddComponent(_ship);
     _ship.Init();
     _ship.Crashed += onCrash;
 }
コード例 #16
0
ファイル: DSceneFactory.cs プロジェクト: chengxu-yh/ET
        public static Scene CreateZoneScene(int zone, string name)
        {
            Scene zoneScene = EntitySceneFactory.CreateScene(Game.IdGenerater.GenerateId(), zone, SceneType.Zone, name, Game.Scene);

            ResourcesComponent.Instance.LoadBundle("Role.unity3d");
            ResourcesComponent.Instance.LoadBundle("Shell.unity3d");
            ResourcesComponent.Instance.LoadBundle("Trap.unity3d");
            ResourcesComponent.Instance.LoadBundle("Tower.unity3d");
            ResourcesComponent.Instance.LoadBundle("Trigger.unity3d");

            zoneScene.AddComponent <ZoneSceneFlagComponent>();
            zoneScene.AddComponent <NetKcpComponent>();
            zoneScene.AddComponent <SceneChangeComponent>();
            zoneScene.AddComponent <DOperaComponent>();
            zoneScene.AddComponent <PVPComponent, bool>(true);
            zoneScene.AddComponent <GamerComponent>();
            zoneScene.AddComponent <DUnitComponent>();

            // mainScene.AddComponent<AIComponent, int>(1);

            // 初始化UI层
            zoneScene.AddComponent <UIEventComponent>();
            zoneScene.AddComponent <UIComponent>();

            return(zoneScene);
        }
コード例 #17
0
ファイル: LoginHelper.cs プロジェクト: x00568/ET
        public static async ETTask Login(Scene clientScene, string account, string password)
        {
            try
            {
                // 创建一个ETModel层的Session
                R2C_Login r2CLogin;
                Session   session = null;
                try
                {
                    clientScene.RemoveComponent <RouterAddressComponent>();
                    // 获取路由跟realmDispatcher地址
                    RouterAddressComponent routerAddressComponent = clientScene.GetComponent <RouterAddressComponent>();
                    if (routerAddressComponent == null)
                    {
                        routerAddressComponent = clientScene.AddComponent <RouterAddressComponent, string, int>(ConstValue.RouterHttpHost, ConstValue.RouterHttpPort);
                        await routerAddressComponent.Init();

                        clientScene.AddComponent <NetKcpComponent, AddressFamily, int>(routerAddressComponent.RouterManagerIPAddress.AddressFamily, CallbackType.SessionStreamDispatcherClientOuter);
                    }
                    IPEndPoint realmAddress = routerAddressComponent.GetRealmAddress(account);

                    session = await RouterHelper.CreateRouterSession(clientScene, realmAddress);

                    {
                        r2CLogin = (R2C_Login)await session.Call(new C2R_Login()
                        {
                            Account = account, Password = password
                        });
                    }
                }
                finally
                {
                    session?.Dispose();
                }

                // 创建一个gate Session,并且保存到SessionComponent中
                Session gateSession = await RouterHelper.CreateRouterSession(clientScene, NetworkHelper.ToIPEndPoint(r2CLogin.Address));

                clientScene.AddComponent <SessionComponent>().Session = gateSession;

                G2C_LoginGate g2CLoginGate = (G2C_LoginGate)await gateSession.Call(
                    new C2G_LoginGate()
                {
                    Key = r2CLogin.Key, GateId = r2CLogin.GateId
                });

                Log.Debug("登陆gate成功!");

                await Game.EventSystem.PublishAsync(clientScene, new EventType.LoginFinish());
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
コード例 #18
0
        public static Scene CreateZoneScene(long id, int zone, string name)
        {
            Scene zoneScene = EntitySceneFactory.CreateScene(id, zone, SceneType.Zone, name, Game.Scene);

            zoneScene.AddComponent <NetOuterComponent>();
            zoneScene.AddComponent <ResourcesComponent>();
            zoneScene.AddComponent <PlayerComponent>();
            zoneScene.AddComponent <UnitComponent>();

            return(zoneScene);
        }
コード例 #19
0
        public static async ETTask <Scene> CreateZoneScene(long id, int zone, string name)
        {
            Scene zoneScene = EntitySceneFactory.CreateScene(id, zone, SceneType.Zone, name, Game.Scene);

            zoneScene.AddComponent <NetOuterComponent>();
            zoneScene.AddComponent <PlayerComponent>();
            zoneScene.AddComponent <UnitComponent>();

            await Game.EventSystem.Publish(new EventType.AfterCreateZoneScene());

            return(zoneScene);
        }
コード例 #20
0
        protected override async ETTask Run(EventType.AfterCreateZoneScene args)
        {
            Scene zoneScene = args.ZoneScene;

#if FAIRYGUI
            zoneScene.AddComponent <FGUIPackageComponent>();
            zoneScene.AddComponent <FGUIComponent, Scene>(zoneScene);
#else
            zoneScene.AddComponent <UIEventComponent>();
            zoneScene.AddComponent <UIComponent>();
#endif
            await ETTask.CompletedTask;
        }
コード例 #21
0
        public static async ETTask <Scene> Create(Entity parent, long id, int zone, string name, SceneType sceneType, StartSceneConfig startSceneConfig = null)
        {
            Scene scene = EntitySceneFactory.CreateScene(id, zone, sceneType, name);

            scene.Parent = parent;

            scene.AddComponent <MailBoxComponent, MailboxType>(MailboxType.UnOrderMessageDispatcher);

            switch (scene.SceneType)
            {
            case SceneType.Realm:
                scene.AddComponent <NetOuterComponent, string>($"{startSceneConfig.OuterPort}:{startSceneConfig.OuterPort}");
                break;

            case SceneType.Gate:
                scene.AddComponent <NetOuterComponent, string>($"{startSceneConfig.OuterPort}:{startSceneConfig.OuterPort}");
                scene.AddComponent <PlayerComponent>();
                scene.AddComponent <GateSessionKeyComponent>();
                break;

            case SceneType.Map:
                scene.AddComponent <UnitComponent>();
                scene.AddComponent <PathfindingComponent>();
                break;

            case SceneType.Location:
                scene.AddComponent <LocationComponent>();
                break;
            }

            return(scene);
        }
コード例 #22
0
        public static async ETTask <Scene> CreateClientScene(int zone, string name, Entity parent)
        {
            await ETTask.CompletedTask;

            Scene clientScene = EntitySceneFactory.CreateScene(zone, SceneType.Client, name, parent);

            clientScene.AddComponent <ClientSceneFlagComponent>();

            clientScene.AddComponent <CurrentScenesComponent>();
            clientScene.AddComponent <ObjectWait>();
            clientScene.AddComponent <PlayerComponent>();

            Game.EventSystem.Publish(clientScene, new EventType.AfterCreateClientScene());
            return(clientScene);
        }
コード例 #23
0
        void CreateObject()
        {
            instanceInScene?.Dispose();

            instanceInScene = (Component_Character2D)Character.Clone();
            Scene.AddComponent(instanceInScene);
        }
コード例 #24
0
        //protected override void Viewport_UpdateBeforeOutput( Viewport viewport )
        //{
        //	base.Viewport_UpdateBeforeOutput( viewport );

        //	//update
        //	if( instanceInScene != null && Time.Current > lastUpdateTime + 0.1 )
        //	{
        //		CreateObject();
        //		lastUpdateTime = Time.Current;
        //	}
        //}

        void CreateObject()
        {
            instanceInScene?.Dispose();

            instanceInScene = (Component_Skybox)Skybox.Clone();
            Scene.AddComponent(instanceInScene);
        }
コード例 #25
0
ファイル: SceneChangeHelper.cs プロジェクト: wikieden/ET
        // 场景切换协程
        public static async ETTask SceneChangeTo(Scene zoneScene, string sceneName, long sceneInstanceId)
        {
            zoneScene.RemoveComponent <AIComponent>();

            CurrentScenesComponent currentScenesComponent = zoneScene.GetComponent <CurrentScenesComponent>();

            currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的
            Scene         currentScene  = SceneFactory.CreateCurrentScene(sceneInstanceId, zoneScene.Zone, sceneName, currentScenesComponent);
            UnitComponent unitComponent = currentScene.AddComponent <UnitComponent>();

            // 可以订阅这个事件中创建Loading界面
            Game.EventSystem.Publish(new EventType.SceneChangeStart()
            {
                ZoneScene = zoneScene
            });

            // 等待CreateMyUnit的消息
            WaitType.Wait_CreateMyUnit waitCreateMyUnit = await zoneScene.GetComponent <ObjectWait>().Wait <WaitType.Wait_CreateMyUnit>();

            M2C_CreateMyUnit m2CCreateMyUnit = waitCreateMyUnit.Message;
            Unit             unit            = UnitFactory.Create(currentScene, m2CCreateMyUnit.Unit);

            unitComponent.Add(unit);

            zoneScene.RemoveComponent <AIComponent>();

            Game.EventSystem.Publish(new EventType.SceneChangeFinish()
            {
                ZoneScene = zoneScene, CurrentScene = currentScene
            });

            // 通知等待场景切换的协程
            zoneScene.GetComponent <ObjectWait>().Notify(new WaitType.Wait_SceneChangeFinish());
        }
コード例 #26
0
        protected override async ETTask Run(EventType.SceneChangeStart args)
        {
            Scene currentScene = args.ZoneScene.CurrentScene();

            // 加载场景资源
            await ResourcesComponent.Instance.LoadBundleAsync($"{currentScene.Name}.unity3d");

            // 切换到map场景

            SceneChangeComponent sceneChangeComponent = null;

            try
            {
                sceneChangeComponent = Game.Scene.AddComponent <SceneChangeComponent>();
                {
                    await sceneChangeComponent.ChangeSceneAsync(currentScene.Name);
                }
            }
            finally
            {
                sceneChangeComponent?.Dispose();
            }


            currentScene.AddComponent <OperaComponent>();
        }
コード例 #27
0
ファイル: SceneFactory.cs プロジェクト: wikieden/ET
        public static Scene CreateZoneScene(int zone, string name, Entity parent)
        {
            Scene zoneScene = EntitySceneFactory.CreateScene(Game.IdGenerater.GenerateInstanceId(), zone, SceneType.Zone, name, parent);

            zoneScene.AddComponent <ZoneSceneFlagComponent>();
            zoneScene.AddComponent <NetKcpComponent, int>(SessionStreamDispatcherType.SessionStreamDispatcherClientOuter);
            zoneScene.AddComponent <CurrentScenesComponent>();
            zoneScene.AddComponent <ObjectWait>();
            zoneScene.AddComponent <PlayerComponent>();

            Game.EventSystem.Publish(new EventType.AfterCreateZoneScene()
            {
                ZoneScene = zoneScene
            });
            return(zoneScene);
        }
コード例 #28
0
    // Helper function that creates a basic scene graph with a video buffer component.
    public void Show()
    {
        Scene s = new Scene(this, 160, 144);

        s.AddComponent(new VideoBufferComponent(0, 0, 160, 144));
        SetSpeedupFlags(SpeedupFlags.NoSound);
    }
コード例 #29
0
        private void CreateBackground()
        {
            var background = new Background();

            Scene.AddComponent(background);
            background.Start();
        }
コード例 #30
0
        public static async ETTask <Scene> CreateZoneScene(int zone, string name)
        {
            Scene zoneScene = EntitySceneFactory.CreateScene(Game.IdGenerater.GenerateId(), zone, SceneType.Zone, name, Game.Scene);

            zoneScene.AddComponent <ZoneSceneFlagComponent>();
            zoneScene.AddComponent <NetKcpComponent>();
            zoneScene.AddComponent <UnitComponent>();

            // UI层的初始化
            await Game.EventSystem.Publish(new EventType.AfterCreateZoneScene()
            {
                ZoneScene = zoneScene
            });

            return(zoneScene);
        }
コード例 #31
0
        protected override void Start()
        {
            // 3d scene with octree and ambient light
            var scene  = new Scene(Context);
            var octree = scene.CreateComponent <Octree>();

            zone = scene.CreateComponent <Zone>();
            zone.AmbientColor = new Color(1, 1, 1) * 0.2f;

            //my comments

            // Camera
            var cameraNode = scene.CreateChild(name: "Camera");
            var camera     = cameraNode.CreateComponent <Urho.Camera>();

            // Light
            var lightNode = cameraNode.CreateChild();

            lightNode.SetDirection(new Vector3(1f, -1.0f, 1f));
            var light = lightNode.CreateComponent <Light>();

            light.Range             = 10;
            light.LightType         = LightType.Directional;
            light.CastShadows       = true;
            Renderer.ShadowMapSize *= 4;

            // Viewport
            viewport = new Viewport(Context, scene, camera, null);
            Renderer.SetViewport(0, viewport);

            // ARCore component
            ArCore = new ARCoreComponent();
            ArCore.ARFrameUpdated  += OnARFrameUpdated;
            ArCore.ConfigRequested += ArCore_ConfigRequested;
            ArCore.Camera           = camera;
            scene.AddComponent(ArCore);

            // Mutant
            mutantNode          = scene.CreateChild();
            mutantNode.Position = new Vector3(0, -0.5f, 0.5f);             // 50cm Y, 50cm Z
            mutantNode.SetScale(0.3f);
            var model = mutantNode.CreateComponent <AnimatedModel>();

            model.CastShadows = true;
            model.Model       = ResourceCache.GetModel("Models/Mutant.mdl");
            model.Material    = ResourceCache.GetMaterial("Materials/mutant_M.xml");
            var ani = mutantNode.CreateComponent <AnimationController>();

            ani.Play("Animations/Mutant_HipHop1.ani", 0, true, 1f);

            fps = new MonoDebugHud(this);
            fps.Show(Color.Blue, 20);

            // Add some post-processing (also, see CorrectGamma())
            viewport.RenderPath.Append(CoreAssets.PostProcess.FXAA2);

            Input.TouchBegin += OnTouchBegin;
            Input.TouchEnd   += OnTouchEnd;
        }