Ejemplo n.º 1
0
Archivo: Eva.cs Proyecto: razluta/jazz2
        public override void OnAttach(ActorInstantiationDetails details)
        {
            base.OnAttach(details);

            RequestMetadata("Object/Eva");
            SetAnimation(AnimState.Idle);

            collisionFlags &= ~CollisionFlags.ApplyGravitation;
        }
Ejemplo n.º 2
0
        public override void OnAttach(ActorInstantiationDetails details)
        {
            base.OnAttach(details);

            collisionFlags = CollisionFlags.CollideWithOtherActors;
            canBeFrozen    = false;

            RequestMetadata("Object/FrozenBlock");
            SetAnimation(AnimState.Idle);
        }
Ejemplo n.º 3
0
        public override void OnAttach(ActorInstantiationDetails details)
        {
            base.OnAttach(details);

            canBeFrozen = false;

            RequestMetadata("Object/Checkpoint");

            SetAnimation("Closed");
        }
Ejemplo n.º 4
0
            public override void OnAttach(ActorInstantiationDetails details)
            {
                base.OnAttach(details);

                collisionFlags = CollisionFlags.None;

                health = int.MaxValue;

                RequestMetadata("Enemy/LizardFloat");
                SetAnimation(AnimState.Activated);
            }
Ejemplo n.º 5
0
            public override void OnAttach(ActorInstantiationDetails details)
            {
                base.OnAttach(details);

                RequestMetadata("Interactive/Shields");

                switch (shieldType)
                {
                case ShieldType.Fire: SetAnimation(front ? "FireFront": "Fire"); break;

                case ShieldType.Water: SetAnimation("Water"); break;
                }
            }
Ejemplo n.º 6
0
        public virtual void OnAttach(ActorInstantiationDetails details)
        {
            this.api   = details.Api;
            this.flags = details.Flags;

            friction = 1.5f;

            originTile = new Point2((int)(details.Pos.X / 32), (int)(details.Pos.Y / 32));

            Transform transform = AddComponent <Transform>();

            transform.Pos = details.Pos;

            AddComponent(new LocalController(this));

            OnUpdateHitbox();
        }
Ejemplo n.º 7
0
        public override void OnAttach(ActorInstantiationDetails details)
        {
            base.OnAttach(details);

            delay = details.Params[0];

            RequestMetadata("Object/Airboard");
            SetAnimation(AnimState.Idle);

            collisionFlags &= ~CollisionFlags.ApplyGravitation;

            //if (delay > 0) {
            //    renderer.Active = false;
            //
            //    timeLeft = delay * Time.FramesPerSecond;
            //} else {
            active = true;
            //}
        }
Ejemplo n.º 8
0
        public override void OnAttach(ActorInstantiationDetails details)
        {
            base.OnAttach(details);

            collisionFlags = CollisionFlags.None;

            type = details.Params[0];

            RequestMetadata("Common/Explosions");

            switch (type)
            {
            default:
            case Tiny: SetAnimation("Tiny"); break;

            case TinyBlue: SetAnimation("TinyBlue"); break;

            case TinyDark: SetAnimation("TinyDark"); break;

            case Small: SetAnimation("Small"); break;

            case SmallDark: SetAnimation("SmallDark"); break;

            case Large: {
                SetAnimation("Large");

                light            = AddComponent <LightEmitter>();
                light.Intensity  = 0.8f;
                light.Brightness = 0.9f;
                light.RadiusNear = 0f;
                light.RadiusFar  = 55f;
                break;
            }

            case SmokeBrown: SetAnimation("SmokeBrown"); break;

            case SmokeGray: SetAnimation("SmokeGray"); break;

            case SmokeWhite: SetAnimation("SmokeWhite"); break;

            case SmokePoof: SetAnimation("SmokePoof"); break;

            case WaterSplash: SetAnimation("WaterSplash"); break;

            case Pepper: {
                SetAnimation("Pepper");

                light            = AddComponent <LightEmitter>();
                light.Intensity  = 0.5f;
                light.Brightness = 0.2f;
                light.RadiusNear = 7f;
                light.RadiusFar  = 14f;
                break;
            }

            case RF: {
                SetAnimation("RF");

                light            = AddComponent <LightEmitter>();
                light.Intensity  = 0.8f;
                light.Brightness = 0.9f;
                light.RadiusNear = 0f;
                light.RadiusFar  = 50f;
                break;
            }

            case Generator: {
                SetAnimation("Generator");

                // Apply random orientation
                Transform.Angle = MathF.Rnd.Next(4) * MathF.PiOver2;
                IsFacingLeft    = (MathF.Rnd.NextFloat() < 0.5f);
                break;
            }
            }
        }
Ejemplo n.º 9
0
        public override void OnAttach(ActorInstantiationDetails details)
        {
            base.OnAttach(details);

            RequestMetadata("Object/Spring");

            type        = details.Params[0];
            orientation = details.Params[1];
            keepSpeedX  = (details.Params[2] != 0);
            keepSpeedY  = (details.Params[3] != 0);
            //delay = details.Params[4];
            //frozen = (details.Params[5] != 0);

            collisionFlags |= CollisionFlags.SkipPerPixelCollisions;

            Vector3 pos = Transform.Pos;

            Vector2 tileCorner = new Vector2((int)(pos.X / 32) * 32, (int)(pos.Y / 32) * 32);

            if (orientation > 3)
            {
                // JJ2 horizontal springs held no data about which way they were facing.
                // For compatibility, the level converter sets their orientation to 5, which is interpreted here.
                Hitbox hitbox = new Hitbox(pos.X + 6, pos.Y - 2, pos.X + 22, pos.Y + 2);
                orientation = (ushort)(api.TileMap.IsTileEmpty(ref hitbox, false) != (orientation == 5) ? 1 : 3);
            }

            int orientationBit = 0;

            switch (orientation)
            {
            case 0:     // Bottom
                MoveInstantly(new Vector2(tileCorner.X + 16, tileCorner.Y + 8), MoveType.Absolute, true);
                break;

            case 1:     // Right
                MoveInstantly(new Vector2(tileCorner.X + 16, tileCorner.Y + 16), MoveType.Absolute, true);
                orientationBit  = 1;
                collisionFlags &= ~CollisionFlags.ApplyGravitation;
                break;

            case 2:     // Top
                MoveInstantly(new Vector2(tileCorner.X + 16, tileCorner.Y + 8), MoveType.Absolute, true);
                orientationBit  = 2;
                collisionFlags &= ~CollisionFlags.ApplyGravitation;
                break;

            case 3:     // Left
                MoveInstantly(new Vector2(tileCorner.X + 16, tileCorner.Y + 16), MoveType.Absolute, true);
                orientationBit  = 1;
                collisionFlags &= ~CollisionFlags.ApplyGravitation;
                IsFacingLeft    = true;
                break;
            }

            // Red starts at 1 in "Object/Spring"
            SetAnimation((AnimState)(((type + 1) << 10) | (orientationBit << 12)));

            if (orientation % 2 == 1)
            {
                // Horizontal springs all seem to have the same strength.
                // This constant strength gives about the correct amount of horizontal push.
                strength = 9.5f;
            }
            else
            {
                // Vertical springs should work as follows:
                // Red spring lifts the player 9 tiles, green 14, and blue 19.
                // Vertical strength currently works differently from horizontal, that explains
                // the otherwise inexplicable difference of scale between the two types.
                switch (type)
                {
                case 0:     // Red
                    strength = 1.25f;
                    break;

                case 1:     // Green
                    strength = 1.50f;
                    break;

                case 2:     // Blue
                    strength = 1.65f;
                    break;
                }
            }

            if ((collisionFlags & CollisionFlags.ApplyGravitation) != 0)
            {
                OnUpdateHitbox();

                // Apply instant gravitation
                int i = 10;
                while (i-- > 0 && MoveInstantly(new Vector2(0f, 4f), MoveType.Relative))
                {
                    // Nothing to do...
                }
                while (i-- > 0 && MoveInstantly(new Vector2(0f, 1f), MoveType.Relative))
                {
                    // Nothing to do...
                }
            }
        }