예제 #1
0
        public PlayerTriggers(ITagContainer diContainer)
        {
            world                    = diContainer.GetTag <DefaultEcs.World>();
            playerControls           = diContainer.GetTag <PlayerControls>();
            zzContainer              = diContainer.GetTag <IZanzarahContainer>();
            zzContainer.OnMouseDown += HandleMouseDown;

            var game = diContainer.GetTag <Game>();

            cameraLocation     = diContainer.GetTag <rendering.Camera>().Location;
            playerLocationLazy = new Lazy <Location>(() => game.PlayerEntity.Get <Location>());

            npcMarker = world.CreateEntity();
            npcMarker.Set(new Location());
            npcMarker.Set(new components.behaviour.Rotate(Vector3.UnitY, 90f));
            npcMarker.Set(ManagedResource <ClumpBuffers> .Create(
                              new resources.ClumpInfo(resources.ClumpType.Model, "marker.dff")));
            ModelLoader.LoadMaterialsFor(npcMarker,
                                         zzio.scn.FOModelRenderType.Solid,
                                         zzio.IColor.Green,
                                         new zzio.SurfaceProperties(1f, 1f, 1f));
            var materials = npcMarker.Get <List <materials.BaseModelInstancedMaterial> >();

            foreach (var material in materials)
            {
                material.Uniforms.Ref.vertexColorFactor = 1f;
            }
        }
예제 #2
0
        private ManagedResource <resources.UITileSheetInfo, TileSheet> Preload(
            out TileSheet tileSheet,
            string name,
            bool isFont,
            float lineHeight  = float.NaN,
            float charSpacing = float.NaN,
            float lineOffset  = float.NaN)
        {
            var resource = ManagedResource <TileSheet> .Create(new resources.UITileSheetInfo(name, isFont));

            var entity = world.CreateEntity();

            entity.Set(resource);
            entity.Disable();
            tileSheet = entity.Get <TileSheet>();
            if (float.IsFinite(lineHeight))
            {
                tileSheet.LineHeight = lineHeight;
            }
            if (float.IsFinite(charSpacing))
            {
                tileSheet.CharSpacing = charSpacing;
            }
            if (float.IsFinite(lineOffset))
            {
                tileSheet.LineOffset = lineOffset;
            }
            return(resource);
        }