Exemplo n.º 1
0
        public override bool RunImpact(RoomScene room, GameObject actor, short gridX, short gridY, DirCardinal dir)
        {
            if (!ToggleBlock.TogCollides(room, this.toggleBR, this.isOn))
            {
                return(false);
            }

            // Actor must cross the DOWN threshold for this ledge; otherwise, it shouldn't compute any collision.
            if (!actor.physics.CrossedThresholdDown(gridY * (byte)TilemapEnum.TileHeight))
            {
                return(false);
            }

            if (actor is Projectile)
            {
                if (!CollideTileFacing.RunImpactTest(dir, DirCardinal.Up))
                {
                    return(false);
                }
                return(TileProjectileImpact.RunImpact((Projectile)actor, gridX, gridY, dir));
            }

            bool collided = CollideTileFacing.RunImpact(actor, gridX, gridY, dir, DirCardinal.Up);

            // Additional Character Collisions (such as Wall Jumps)
            if (collided && actor is Character)
            {
                TileCharBasicImpact.RunWallImpact((Character)actor, dir);
            }

            return(collided);
        }
Exemplo n.º 2
0
        public override bool RunImpact(RoomScene room, GameObject actor, short gridX, short gridY, DirCardinal dir)
        {
            if (!ToggleBlock.TogCollides(room, this.toggleBR, this.isOn))
            {
                return(false);
            }

            // Actor must cross the UP threshold for this ledge; otherwise, it shouldn't compute any collision.
            if (!actor.physics.CrossedThresholdUp(gridY * (byte)TilemapEnum.TileHeight + (byte)TilemapEnum.TileHeight))
            {
                return(false);
            }

            if (actor is Projectile)
            {
                if (!CollideTileFacing.RunImpactTest(dir, DirCardinal.Down))
                {
                    return(false);
                }
                return(TileProjectileImpact.RunImpact((Projectile)actor, gridX, gridY, dir));
            }

            // Allow Dropdown Mechanic
            if (actor is Character)
            {
                Character character = (Character)actor;
                character.physics.touch.onMover = true;
                if (character.status.action is DropdownAction)
                {
                    return(false);
                }
            }

            return(CollideTileFacing.RunImpact(actor, gridX, gridY, dir, DirCardinal.Down));
        }
Exemplo n.º 3
0
        public override bool RunImpact(RoomScene room, GameObject actor, short gridX, short gridY, DirCardinal dir)
        {
            if (this.isToggleBox || ToggleBlock.TogCollides(room, this.toggleBR, this.isOn))
            {
                if (actor is Projectile)
                {
                    if (actor is ShurikenProjectile && this.isToggleBox)
                    {
                        room.colors.ToggleColor(this.toggleBR);
                    }
                    return(TileProjectileImpact.RunImpact((Projectile)actor, gridX, gridY, dir));
                }

                TileSolidImpact.RunImpact(actor, gridX, gridY, dir);

                // If a ToggleBox was hit from below:
                if (this.isToggleBox && dir == DirCardinal.Up)
                {
                    room.colors.ToggleColor(this.toggleBR);
                }

                // Additional Character Collisions (such as Wall Jumps)
                if (actor is Character)
                {
                    TileCharBasicImpact.RunWallImpact((Character)actor, dir);
                }

                return(true);
            }

            return(false);
        }