Пример #1
0
        private void AddToGamePoolWithDoor(Vector3?pos = null)
        {
            GamePool.AddObjectToPool(this);

            Vector3 position;

            if (pos.HasValue)
            {
                position = pos.Value;
            }
            else
            {
                position = this.Position;
            }

            // Create a door case as connector between tunnels.
            _tunnelDoor       = Door.Create(new Vector3(position.x, position.y, position.z), 0);
            _tunnelDoor.Speed = LevelGeometry.GlobalGeomSpeed;

            // Create random door types
            int rand = Random.Next(3);

            if (rand != 0)
            {
                _tunnelDoor       = Door.Create(new Vector3(position.x, position.y, position.z), rand);
                _tunnelDoor.Speed = LevelGeometry.GlobalGeomSpeed;
            }

            ColorF lightColor = new ColorF(Random.Next(0, 255), Random.Next(0, 255), Random.Next(0, 255));

            // Till 'MaxValue' as the for-loop is quit when once the first empty position is discovered.
            for (int i = 1; i < int.MaxValue; i++)
            {
                Vector3 helperPos = GetHelperPos(0, "Light_0" + i.ToString());

                if (helperPos.x != 0 || helperPos.y != 0 || helperPos.z != 0)
                {
                    CDLight light = new CDLight()
                    {
                        m_fRadius = 25f,
                        m_fAttenuationBulbSize = 0.1f,
                        m_BaseColor            = lightColor,
                        m_BaseSpecMult         = 1f
                    };

                    LoadLight(i, light);
                    SetGeometrySlotLocalTransform(i, new Matrix3x4(Vector3.One, Quaternion.Identity, helperPos));
                }
                else
                {
                    break;
                }
            }
        }
Пример #2
0
 internal DynamicLight(CDLight nativeHandle) : base(nativeHandle)
 {
     NativeHandle = nativeHandle;
 }
Пример #3
0
 /// <summary>
 /// Loads a light into a given slot.
 /// </summary>
 /// <param name="slot">Slot.</param>
 /// <param name="light">Light.</param>
 public void LoadLight(int slot, CDLight light)
 {
     NativeHandle.LoadLight(slot, light);
 }
Пример #4
0
 /// <summary>
 /// Loads a light into a given slot.
 /// </summary>
 /// <param name="slot">Slot.</param>
 /// <param name="light">Light.</param>
 public void LoadLight(int slot, CDLight light)
 {
     BaseEntity.LoadLight(slot, light);
 }