Ejemplo n.º 1
0
        public LaserSensor(EntityData data, Vector2 offset) : base(data.Position + offset)
        {
            active          = false;
            flag            = data.Attr("flag", "");
            mode            = data.Attr("mode", "Continuous");
            blockLight      = bool.Parse(data.Attr("blockLight", "true"));
            activationColor = ColorHelper.GetColor(data.Attr("color", "#87CEFA"));
            id = data.ID;

            orbSprite        = new Monocle.Image(GFX.Game["objects/pandorasBox/laser/sensor/orb"]);
            orbSprite.Origin = new Vector2(orbSprite.Width / 2f, orbSprite.Height / 2f);
            orbEntity        = new Entity(Position);
            orbEntity.Add(orbSprite);
            orbEntity.Depth = 50;

            metalRingSprite        = new Monocle.Image(GFX.Game["objects/pandorasBox/laser/sensor/metal_ring"]);
            metalRingSprite.Origin = new Vector2(metalRingSprite.Width / 2f, metalRingSprite.Height / 2f);
            lightRingSprite        = new Monocle.Image(GFX.Game["objects/pandorasBox/laser/sensor/light_ring"]);
            lightRingSprite.Origin = new Vector2(lightRingSprite.Width / 2f, lightRingSprite.Height / 2f);
            lightRingSprite.SetColor(activationColor);
            Add(metalRingSprite);
            Add(lightRingSprite);
            Depth = 200;

            LaserDetectionCollider = new Hitbox(8f, 8f, -4f, -4f);

            if (blockLight)
            {
                LaserBlockingCollider = new Hitbox(4f, 4f, -2f, -2f);
            }
        }
Ejemplo n.º 2
0
        public DrivableCar(EntityData data, Vector2 offset) : base(data.Position + offset)
        {
            // TODO - Fix this, needs a entity per depthed image
            this.Depth = 1;
            this.Add(this.bodySprite = new Monocle.Image(GFX.Game["scenery/car/body"]));
            this.bodySprite.Origin   = new Vector2(this.bodySprite.Width / 2f, this.bodySprite.Height);

            this.Depth = 3;
            this.Add(this.wheelsSprite = new Monocle.Image(GFX.Game["scenery/car/wheels"]));
            this.wheelsSprite.Origin   = new Vector2(this.wheelsSprite.Width / 2f, this.wheelsSprite.Height);

            base.Add(new PlayerCollider(new Action <Player>(this.OnPlayer)));
            this.Collider = new Hitbox(40, 18, -20, -18);

            this.Add(talker     = new TalkComponent(new Rectangle(-8, -8, 16, 16), new Vector2(0.0f, -24f), this.OnTalk, null));
            this.talker.Enabled = false;

            this.acceleration = float.Parse(data.Attr("acceleration", "256"));
            this.deceleration = float.Parse(data.Attr("deceleration", "384"));
            this.maxSpeed     = float.Parse(data.Attr("maxSpeed", "384"));

            this.brokenDoor         = bool.Parse(data.Attr("brokenDoor", "false"));
            this.keepCarSpeedOnExit = bool.Parse(data.Attr("keepCarSpeedOnExit", "false"));

            this.nitroAcceleration    = float.Parse(data.Attr("nitroAcceleration", "448"));
            this.nitroMaxDuration     = float.Parse(data.Attr("nitroMaxDuration", "3"));
            this.nitroRegenMultiplier = float.Parse(data.Attr("nitroRegenMultiplier", "0.2"));
            this.nitroDuration        = this.nitroMaxDuration;

            this.nitroActive = false;

            this.breakingDuration = 0;
            this.facing           = int.Parse(data.Attr("facing", "1"));

            this.onCollideH = new Collision(this.OnCollideH);
            this.onCollideV = new Collision(this.OnCollideV);

            this.prevLiftSpeed = Vector2.Zero;

            this.exhaustAcc = 0.0;

            this.springGrace = 0.3;
            this.enterGrace  = 0.5;

            this.id = data.ID;

            this.AddTag(Tags.TransitionUpdate);
        }