Ejemplo n.º 1
0
        private void InitCamera(ECSEngine engine)
        {
            _sm.RegisterSystem("Game", new CameraSystem());

            var camera = EntityFactory.Instance.NewEntityWithTag("3DCamera");
            var cc     = new CameraComponent(engine.GetGraphicsDeviceManager())
            {
                position         = new Vector3(0, 20, 60),
                camChasePosition = new Vector3(0f, 30f, 70f)
            };

            ComponentManager.Instance.AddComponentToEntity(camera, cc);
            ComponentManager.Instance.AddComponentToEntity(camera, new TransformComponent());
            ComponentManager.Instance.AddComponentToEntity(camera, new PlayerComponent());
            ComponentManager.Instance.RemoveComponentFromEntity <PlayerComponent>(camera);

            CameraSystem.SetTargetEntity("Kart");
            SceneManager.Instance.AddEntityToSceneOnLayer("Game", 6, camera);
            CameraSystem.SetCameraFrustrum();
            CameraSystem.SetFarClipPlane(1000);
        }