예제 #1
0
        public static EmitterSimple Knockout(RoomScene room, string spriteName, int posX, int posY, byte duration = 60)
        {
            int frame = Systems.timer.Frame;

            // Prepare Emnitter
            EmitterSimple emitter = EmitterSimple.NewEmitter(room, Systems.mapper.atlas[(byte)AtlasGroup.Objects], spriteName, new Vector2(posX, posY), new Vector2(0, 0), 0.5f, frame + duration, frame + duration - 25);

            // Randomize Knockout Direction and Rotation
            Vector2 randVelocity = new Vector2(
                CalcRandom.FloatBetween(-4.5f, 4.5f),
                CalcRandom.FloatBetween(-5f, -11f)
                );

            float rotSpeed = CalcRandom.FloatBetween(0.07f, 0.15f) * (CalcRandom.IntBetween(1, 100) >= 51 ? 1 : -1);

            // Add Knockout Particle
            emitter.AddParticle(
                new Vector2(posX, posY),
                randVelocity,
                0,
                rotSpeed
                );

            return(emitter);
        }
예제 #2
0
        public CollideSequence(RoomScene room)
        {
            this.room  = room;
            this.broad = new CollideBroad();

            // Build the Collision Pool
            //this.pool = ArrayPool<int>.Shared;
        }
예제 #3
0
        }                                                               // TRUE if the actor is facing right.

        public GameObject(RoomScene room, byte subType, FVector pos, Dictionary <string, short> paramList = null)
        {
            this.room    = room;
            this.id      = room == null ? 0 : room.nextId;
            this.subType = subType;
            this.posX    = pos.X.RoundInt;
            this.posY    = pos.Y.RoundInt;

            this.SetCollide(CollideEnum.Standard);
        }
예제 #4
0
        public static EmitterSimple GravityParticle(RoomScene room, string spriteName, int posX, int posY, byte duration = 8, float ySpeed = -3f, float gravity = 0.5f)
        {
            int frame = Systems.timer.Frame;

            EmitterSimple emitter = EmitterSimple.NewEmitter(room, Systems.mapper.atlas[(byte)AtlasGroup.Tiles], spriteName, new Vector2(posX, posY), new Vector2(0, 0), gravity, frame + duration, frame + duration, 1, 1);

            emitter.AddParticle(new Vector2(posX, posY), new Vector2(0, ySpeed), 0, 0);

            return(emitter);
        }
예제 #5
0
        public static EmitterSimple DirectionParticle(RoomScene room, string spriteName, int posX, int posY, byte duration = 8, float xSpeed = 0f, float ySpeed = 0f)
        {
            int frame = Systems.timer.Frame;

            EmitterSimple emitter = EmitterSimple.NewEmitter(room, Systems.mapper.atlas[(byte)AtlasGroup.Objects], spriteName, new Vector2(posX, posY), new Vector2(0, 0), 0, frame + duration, frame + duration, 1, 1);

            emitter.AddParticle(new Vector2(posX, posY), new Vector2(xSpeed, ySpeed), 0, 0);

            return(emitter);
        }
예제 #6
0
        public static EmitterSimple AirPuff(RoomScene room, int posX, int posY, sbyte dirHor, sbyte dirVert, byte duration = 8)
        {
            int frame = Systems.timer.Frame;

            // Readjust positions to adjust for midX and midY of AirPuff image.
            posX -= 20;
            posY -= 20;

            float radian = Radians.GetRadiansByCardinalDir((sbyte)-dirHor, (sbyte)-dirVert);

            // Get the Particle Directions based on Cardinal Steps from the original.
            float rad1 = Radians.GetRadiansByCardinalDir((sbyte)-dirHor, (sbyte)-dirVert, -3);
            float rad2 = Radians.GetRadiansByCardinalDir((sbyte)-dirHor, (sbyte)-dirVert, 3);

            float xOffset  = Radians.GetXOffsetFromRotation(radian, 15, -15);
            float xOffset2 = Radians.GetXOffsetFromRotation(radian, 15, 15);
            float yOffset  = Radians.GetYOffsetFromRotation(radian, 15, -15);
            float yOffset2 = Radians.GetYOffsetFromRotation(radian, 15, 15);

            EmitterSimple emitter = EmitterSimple.NewEmitter(room, Systems.mapper.atlas[(byte)AtlasGroup.Objects], "Particles/AirPuff", new Vector2(posX, posY), new Vector2(0, 0), 0f, frame + duration, frame + duration - 25);

            // Launch First Particle
            emitter.AddParticle(
                new Vector2(
                    posX + xOffset,
                    posY + yOffset
                    ),
                new Vector2(
                    dirHor * -1.5f + (xOffset / 16),
                    dirVert * -1.5f + (yOffset / 16)
                    ),
                rad1 - 0.5f,
                0f
                );

            // Launch Second Particle
            emitter.AddParticle(
                new Vector2(
                    posX + xOffset2,
                    posY + yOffset2
                    ),
                new Vector2(
                    dirHor * -1.5f + (xOffset2 / 16),
                    dirVert * -1.5f + (yOffset2 / 16)
                    ),
                rad2 + 0.5f,
                0f
                );

            return(emitter);
        }
예제 #7
0
        public static StationaryParticle SetParticle(RoomScene room, Atlas atlas, string spriteName, Vector2 pos, int frameEnd)
        {
            // Retrieve an available particle from the pool.
            StationaryParticle particle = StationaryParticle.stationPool.GetObject();

            particle.atlas      = atlas;
            particle.spriteName = spriteName;
            particle.pos        = pos;
            particle.frameEnd   = frameEnd;

            // Add the Particle to the Particle Handler
            room.particleHandler.AddParticle(particle);

            return(particle);
        }
예제 #8
0
        public static EndBounceParticle SetParticle(RoomScene room, Atlas atlas, string spriteName, Vector2 pos, int frameEnd, float bounceHeight = 3, float gravity = 0.5f, float rotateSpeed = 0.12f)
        {
            // Retrieve an available particle from the pool.
            EndBounceParticle particle = EndBounceParticle.endBouncePool.GetObject();

            particle.atlas         = atlas;
            particle.spriteName    = spriteName;
            particle.pos           = pos;
            particle.frameEnd      = frameEnd;
            particle.gravity       = gravity;
            particle.vel           = new Vector2(CalcRandom.FloatBetween(-3, 3), CalcRandom.FloatBetween(-bounceHeight - 1.5f, -bounceHeight + 1.5f));
            particle.rotationSpeed = CalcRandom.FloatBetween(-rotateSpeed, rotateSpeed);

            // Add the Particle to the Particle Handler
            room.particleHandler.AddParticle(particle);

            return(particle);
        }
예제 #9
0
        public static void SetCharFadeParticle(RoomScene room, Character character, int frameEnd, float alpha, float alphaDecay = -0.03f)
        {
            // Draw Suit
            StayFadeParticle particle = StayFadeParticle.stayPool.GetObject();

            particle.atlas = Systems.mapper.atlas[(byte)AtlasGroup.Objects];
            //particle.spriteName = character.suit.texture + "Run" + (character.FaceRight ? "" : "Left");
            particle.spriteName = character.suit.texture + character.SpriteName;
            particle.pos        = new Vector2(character.posX, character.posY);
            particle.alphaStart = alpha;
            particle.alphaEnd   = alphaDecay;
            particle.frameEnd   = frameEnd;
            room.particleHandler.AddParticle(particle);

            // Draw Head
            StayFadeParticle headPart = StayFadeParticle.stayPool.GetObject();

            headPart.atlas      = Systems.mapper.atlas[(byte)AtlasGroup.Objects];
            headPart.spriteName = character.head.SpriteName + (character.FaceRight ? "Right" : "Left");
            headPart.pos        = new Vector2(character.posX, character.posY);
            headPart.alphaStart = alpha;
            headPart.alphaEnd   = alphaDecay;
            headPart.frameEnd   = frameEnd;
            room.particleHandler.AddParticle(headPart);

            // Draw Hat
            if (character.hat is Hat)
            {
                StayFadeParticle hatPart = StayFadeParticle.stayPool.GetObject();
                hatPart.atlas      = Systems.mapper.atlas[(byte)AtlasGroup.Objects];
                hatPart.spriteName = character.hat.SpriteName + (character.FaceRight ? "" : "Left");
                hatPart.pos        = new Vector2(character.posX, character.posY);
                hatPart.alphaStart = alpha;
                hatPart.alphaEnd   = alphaDecay;
                hatPart.frameEnd   = frameEnd;
                room.particleHandler.AddParticle(hatPart);
            }
        }
예제 #10
0
        public static EmitterSimple BoxExplosion(RoomScene room, string spriteName, int posX, int posY, sbyte xSpread = 3, sbyte ySpread = 3, byte duration = 55)
        {
            int frame = Systems.timer.Frame;

            EmitterSimple emitter = EmitterSimple.NewEmitter(room, Systems.mapper.atlas[(byte)AtlasGroup.Objects], spriteName, new Vector2(posX, posY), new Vector2(0, 0), 0.5f, frame + duration, frame + duration - 25);

            float radianUpLeft  = -1.82f;            // -5, -20
            float radianUpRight = -1.32f;            // 5, -20

            // Launch Up-Left Particle
            emitter.AddParticle(
                new Vector2(
                    posX - (int)Math.Floor(xSpread * CalcRandom.FloatBetween(0.5f, 2f)),
                    posY - (int)Math.Floor(ySpread * CalcRandom.FloatBetween(0.5f, 2f))
                    ),
                new Vector2(
                    CalcRandom.FloatBetween(-0.25f, -1.5f),
                    CalcRandom.FloatBetween(-9f, -13f)
                    ),
                radianUpLeft + CalcRandom.FloatBetween(-0.6f, 0.6f),
                -0.08f + CalcRandom.FloatBetween(-0.12f, 0.12f)
                );

            // Launch Up-Right Particle
            emitter.AddParticle(
                new Vector2(
                    posX + (int)Math.Floor(xSpread * CalcRandom.FloatBetween(0.5f, 2f)),
                    posY - (int)Math.Floor(ySpread * CalcRandom.FloatBetween(0.5f, 2f))
                    ),
                new Vector2(
                    CalcRandom.FloatBetween(0.25f, 1.5f),
                    CalcRandom.FloatBetween(-9f, -13f)
                    ),
                radianUpRight + CalcRandom.FloatBetween(-0.6f, 0.6f),
                0.08f + CalcRandom.FloatBetween(-0.12f, 0.12f)
                );

            // Launch Down-Left Particle
            emitter.AddParticle(
                new Vector2(
                    posX - (int)Math.Floor(xSpread * CalcRandom.FloatBetween(0.5f, 2f)),
                    posY + (int)Math.Floor(ySpread * CalcRandom.FloatBetween(0.5f, 2f))
                    ),
                new Vector2(
                    CalcRandom.FloatBetween(-0.25f, -1.5f),
                    CalcRandom.FloatBetween(-4f, -7f)
                    ),
                radianUpLeft + CalcRandom.FloatBetween(-0.6f, 0.6f),
                -0.08f + CalcRandom.FloatBetween(-0.12f, 0.12f)
                );

            // Launch Down-Right Particle
            emitter.AddParticle(
                new Vector2(
                    posX + (int)Math.Floor(xSpread * CalcRandom.FloatBetween(0.5f, 2f)),
                    posY + (int)Math.Floor(ySpread * CalcRandom.FloatBetween(0.5f, 2f))
                    ),
                new Vector2(
                    CalcRandom.FloatBetween(0.25f, 1.5f),
                    CalcRandom.FloatBetween(-4f, -7f)
                    ),
                radianUpRight + CalcRandom.FloatBetween(-0.6f, 0.6f),
                0.08f + CalcRandom.FloatBetween(-0.12f, 0.12f)
                );

            return(emitter);
        }
예제 #11
0
 public virtual bool RunImpact(RoomScene room, GameObject actor, short gridX, short gridY, DirCardinal dir)
 {
     TileSolidImpact.RunImpact(actor, gridX, gridY, dir);
     return(true);
 }
예제 #12
0
 public virtual void Draw(RoomScene room, byte subType, int posX, int posY)
 {
     //this.atlas.Draw(texture, posX, posY);
 }
예제 #13
0
 // Return false if (and/or when) the event should no longer be looped in the QueueEvent class for a given beatMod.
 public virtual bool TriggerEvent(RoomScene room, short gridX, short gridY, short val1 = 0, short val2 = 0)
 {
     return(false);            // Removes from QueueEventClass
 }