示例#1
0
        public Key(Rectangle pos, Map map)
            : base(map)
        {
            Body BodyDec = new Body(map.PhysicalWorld);
            BodyDec.BodyType = BodyType.Static;

            PolygonShape S = new PolygonShape(1f);
            S.SetAsBox(pos.Width / 2, pos.Height / 2);

            Fixture = BodyDec.CreateFixture(S);
            Fixture.Restitution = 1f;
            Fixture.Friction = 10f;

            this.Position = pos;

            SetName("Key");

            LightingEngine LE = (LightingEngine)Renderer.GetRenderEffect("LightingEngine");

            light = new PointLight()
            {
                IsEnabled = true,
                Color = new Vector4(0.95f, .7f, .05f, 1f),
                Power = power,
                LightDecay = 350,
                Position = new Vector3(Position.X, Position.Y, 20),
                Direction = new Vector3(0,0, 0)
            };

            LE.AddLight(light);
        }
示例#2
0
        public RedAlarmLamp(Rectangle r, Map m)
            : base(m)
        {
            Body BodyDec = new Body(m.PhysicalWorld);
            BodyDec.BodyType = BodyType.Static;

            PolygonShape S = new PolygonShape(1f);
            S.SetAsBox(r.Width / 2, r.Height / 2);

            Fixture = BodyDec.CreateFixture(S);
            Fixture.Restitution = 1f;
            Fixture.Friction = 10f;

            Position = r;

            SetName("RedAlarmLamp");

            AlertLight = new SpotLight()
            {
                IsEnabled = true,
                Color = new Vector4(0.9f, .1f, .1f, 1f),
                Power = .6f,
                LightDecay = 600,
                Position = new Vector3(r.X, r.Y, 20),
                SpotAngle = 1.5f,
                SpotDecayExponent = 3,
                Direction = new Vector3(0.244402379f, 0.969673932f, 0)
            };

            LightingEngine LE = (LightingEngine)Renderer.GetRenderEffect("LightingEngine");
            LE.AddLight(AlertLight);
        }
示例#3
0
 /// <summary>
 /// Copy all the base fields.
 /// </summary>
 /// <param name="light">The light.</param>
 protected void CopyBaseFields(Light light)
 {
     light.Color = this.Color;
     light.IsEnabled = this.IsEnabled;
     light.LightDecay = this.LightDecay;
     light.LightType = this.LightType;
     light.Position = this.Position;
     light.Power = this.Power;
 }
示例#4
0
 public void RemoveLight(Light Light)
 {
     _lights.Remove(Light);
 }
示例#5
0
        public void AddLight(Light Light)
        {
            _lights.Add(Light);

            Krypton.Lights.Add(Light.KryptonLight);
        }
示例#6
0
        public Player(Rectangle pos, Map m)
            : base(m)
        {
            Body BodyDec = new Body(m.PhysicalWorld);
            BodyDec.BodyType = BodyType.Dynamic;

            Fixture = BodyDec.CreateFixture(new CircleShape(15f, 1.0f));

            Body BodyDecSensor = new Body(m.PhysicalWorld);
            BodyDecSensor.BodyType = BodyType.Dynamic;

            PlayerSensor = BodyDecSensor.CreateFixture(new CircleShape(15f, .0f));
            PlayerSensor.Body.IsSensor = true;
            PlayerSensor.OnCollision += OnSensorCollide;

            this.Name = "player";
            this.texName = "Mobs/" + Name;
            this.normalName = "Mobs/" + Name + "_normal";

            this.Position = pos;
            hp = 100;
            def = 10;
            damage = 5;
            lucky = 123135;
            this.map = m;
            speed = 15500f;

            weapon = new AK47();

            IdleAnim = new Animation();
            IdleNormalAnim = new AnimationNormal();

            WalkAnim = new Animation();
            WalkNormalAnim = new AnimationNormal();

            IdleAnim = GeneralManager.Animations["PlayerIdle"];
            IdleAnim.Center = Vector2.One * 32;

            IdleNormalAnim.Load("PlayerIdle_normal", Vector2.One * 64, 1, 10000, (LightingEngine)Renderer.GetRenderEffect("LightingEngine"));
            IdleNormalAnim.Center = Vector2.One * 32;

            WalkAnim = GeneralManager.Animations["TestAnim"];
            WalkAnim.Center = Vector2.One * 32;

            WalkNormalAnim.Load("TestAnim_normal", Vector2.One * 64, 6, 80, (LightingEngine)Renderer.GetRenderEffect("LightingEngine"));
            WalkNormalAnim.Center = Vector2.One * 32;

            LightingEngine LE = (LightingEngine)Renderer.GetRenderEffect("LightingEngine");

            ShootLight = new SpotLight()
            {
                IsEnabled = true,
                Color = new Vector4(0.95f, .7f, .05f, 1f),
                Power = .6f,
                LightDecay = 600,
                Position = new Vector3(500, 400, 20),
                SpotAngle = 2f * 3.1415f,
                SpotDecayExponent = 3,
                Direction = new Vector3(0.244402379f, 0.969673932f, 0)
            };

            LE.AddLight(ShootLight);

            stoper = new Stopwatch();
            stoper.Start();
        }