Пример #1
0
        public static LightGameObject CreateDirectionLight(IEntityManager manager, Vector3 direction)  // ,
        {
            var tag = new ElementTag("DirectionLight_" + Interlocked.Increment(ref lights));

            manager.CreateEntity(tag)
            .AddComponents(
                LightComponent.CreateDirectional(0.2f, 2, direction),
                ColorComponent.CreateDiffuse(new Vector4(1, 1, 1, 1))
                );

            return(new LightGameObject(tag, "DirectionLight"));
        }
Пример #2
0
        public static LightObject CreateDirectionLight(IEntityManager manager, Vector3 direction, float intensity)  // ,
        {
            var index = 2;

            if (!occupiedIndex.Add(index))
            {
                throw new LightIndexOccupiedException(index);
            }

            var tag = new ElementTag("DirectionLight_" + Interlocked.Increment(ref lights));

            manager.CreateEntity(tag)
            .AddComponent(LightComponent.CreateDirectional(intensity, index, direction))
            .AddComponent(ColorComponent.CreateDiffuse(new Vector4(1, 1, 1, 1)));

            return(new LightObject(tag, "DirectionLight"));
        }