示例#1
0
        private void InitializeCameraDb()
        {
            Log.ActivateLog(LogMessageType.Debug);

            // Register this class as a service, this script must execute before camera agent scripts... set priorities accordingly in game studio.
            Services.AddService(this);
        }
示例#2
0
        private void InitializeOutlineComponent()
        {
            Log.ActivateLog(LogMessageType.Info);

            modelComponent = Entity.Get <ModelComponent>();
            if (modelComponent == null)
            {
                Log.Error($"Model component not found on outline component.");
                //throw new NullReferenceException($"Model component not found on outline component.");
            }
            else
            {
                configuredRenderGroup = modelComponent.RenderGroup;
            }

            // Model outline highlighting uses physics ray casting in BasicCameraController
            physicsComponent = Entity.Get <PhysicsComponent>();
            if (physicsComponent == null && AlwaysOutlined != true)
            {
                Log.Error($"Physics collider component not found on outline component.");
                //throw new NullReferenceException($"Collider component not found outline component.");
            }

            if (AlwaysOutlined)
            {
                Enable();
            }
        }
示例#3
0
 public override void Start()
 {
     //Entity.Transform.Position = Vector3.UnitY;
     Log.ActivateLog(LogMessageType.Info);
     // var fox_glb = SharpGLTF.Schema2.ModelRoot.Load("D:/Downloads/glTF/cube/AnimatedCube.gltf");
     //fox_glb = SharpGLTF.Schema2.ModelRoot.Load("D:/Downloads/glTF/fox/Fox.gltf");
     // var fox_glb = SharpGLTF.Schema2.ModelRoot.Load("D:/Downloads/glTF/icosphere/icosphere.gltf");
     // var fox_glb = SharpGLTF.Schema2.ModelRoot.Load("D:/Downloads/glTF/torus/torus.gltf");
     //fox_glb = SharpGLTF.Schema2.ModelRoot.Load("C:/Users/kafia/Documents/blender try/SimpleCube.gltf");
     //fox_glb = SharpGLTF.Schema2.ModelRoot.ReadGLB(File.OpenRead("D:/codeProj/xenproj/GltfImport/GltfImport/Resources/Fox.glb"));
     fox_glb = SharpGLTF.Schema2.ModelRoot.Load("D:/codeProj/xenproj/GltfImport/GltfImport/Resources/FoxEmbedded.gltf");
 }
        private void RegisterCamera()
        {
            Log.ActivateLog(LogMessageType.Debug);

            var cameraDb        = Services.GetService <CameraDb>();
            var cameraComponent = Entity.Get <CameraComponent>();

            if (cameraComponent == null)
            {
                Log.Error($"{Entity.Name} attempted to register a camera when no camera component is attached.");
                return;
            }

            cameraDb?.RegisterCamera(Entity.Get <CameraComponent>());
        }
示例#5
0
        public override void Start()
        {
            model  = this.Entity.Get <ModelComponent>().Model;
            oldmat = model.Materials[0];
            var desc = new MaterialDescriptor
            {
                Attributes =
                    new MaterialAttributes
                {
                    Diffuse      = new MaterialDiffuseMapFeature(new ComputeColor(Color.AliceBlue)),
                    MicroSurface = new MaterialGlossinessMapFeature(new ComputeFloat(3)),
                    Emissive     = new MaterialEmissiveMapFeature(new ComputeFloat4(new Vector4(5, 0, 0, 1)))
                }
            };

            mat = new MaterialInstance(Material.New(GraphicsDevice, desc));
            Log.ActivateLog(LogMessageType.Info);
        }
示例#6
0
        private void InitializeFogOfWar()
        {
            Log.ActivateLog(LogMessageType.Debug);

            fogDetectors   = new Dictionary <string, FogOfWarDetector>();
            fogSubscribers = new Dictionary <string, FogOfWarSubscriber>();

            var modelComponent = Entity.FindChild("FogOfWar").FindChild("FogOfWarLayer1").Get <ModelComponent>();

            modelComponent.Enabled = true;

            Entity.FindChild("Orthographic").Get <CameraComponent>().Enabled = true;

            var perspective = Entity.FindChild("Perspective").Get <CameraComponent>();

            perspective.Enabled = true;
            perspective.Slot    = SceneSystem.GraphicsCompositor.Cameras[0].ToSlotId();

            modelComponent.GetMaterial(0).Passes[0].Parameters.Set(FogOfWarPlusShaderKeys.FogOpacity, FogOpacity);
        }
示例#7
0
        private void InitializePlayerInput()
        {
            Log.ActivateLog(LogMessageType.Debug);

            sphere = SceneSystem.SceneInstance.RootScene.Entities.FirstOrDefault(a => a.Name == "Sphere");
            if (sphere == null)
            {
                Log.Error($"Sphere entity could not be located in scene.");
            }
            else
            {
                Log.Debug($"Sphere has been attached to player input");
            }

            cameraDb = Services.GetService <CameraDb>();
            if (cameraDb == null)
            {
                Log.Error($"Camera db service could not be found in the service registry.");
            }
            else
            {
                Log.Debug($"Camera db service was found in the service registry.");
            }
        }
示例#8
0
 public override void Start()
 {
     Log.ActivateLog(LogMessageType.Info);
 }