Beispiel #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);
        }
Beispiel #2
0
        public override bool RunImpact(RoomScene room, GameObject actor, short gridX, short gridY, DirCardinal dir)
        {
            // Get the Direction of an Inner Boundary
            DirCardinal newDir = TileSolidImpact.RunInnerImpact(actor, gridX * (byte)TilemapEnum.TileWidth, gridX * (byte)TilemapEnum.TileWidth + (byte)TilemapEnum.TileWidth, gridY * (byte)TilemapEnum.TileHeight, gridY * (byte)TilemapEnum.TileHeight + (byte)TilemapEnum.HalfHeight);

            if (newDir == DirCardinal.None)
            {
                return(false);
            }

            if (newDir == DirCardinal.Down)
            {
                // Get the SubType
                byte subType = room.tilemap.GetMainSubType(gridX, gridY);

                if (subType <= (byte)ConveyorSubType.Left)
                {
                    actor.physics.SetExtraMovement(subType == (byte)ConveyorSubType.SlowLeft ? -2 : -4, 0);
                }
                else
                {
                    actor.physics.SetExtraMovement(subType == (byte)ConveyorSubType.SlowRight ? 2 : 4, 0);
                }
            }

            if (actor is Character)
            {
                return(TileCharBasicImpact.RunWallImpact((Character)actor, dir));
            }

            return(true);
        }
Beispiel #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);
        }
Beispiel #4
0
        public override bool RunCharacterImpact(Character character)
        {
            DirCardinal dir = CollideDetect.GetDirectionOfCollision(character, this);

            if (dir == DirCardinal.Left)
            {
                TileCharBasicImpact.RunWallImpact(character, dir, DirCardinal.None);
            }
            else if (dir == DirCardinal.Right)
            {
                TileCharBasicImpact.RunWallImpact(character, dir, DirCardinal.None);
            }

            // Character is Beneath
            else if (dir == DirCardinal.Up)
            {
                if (this.physics.velocity.Y > 0)
                {
                    character.wounds.ReceiveWoundDamage(DamageStrength.Standard);

                    // Will kill if character is on ground.
                    if (character.physics.touch.toBottom)
                    {
                        character.wounds.ReceiveWoundDamage(DamageStrength.InstantKill);
                        return(true);
                    }
                }

                TileCharBasicImpact.RunWallImpact(character, dir, DirCardinal.None);
            }

            return(Impact.StandardImpact(character, this, dir));
        }
Beispiel #5
0
        public override bool RunImpact(RoomScene room, GameObject actor, short gridX, short gridY, DirCardinal dir)
        {
            if (actor is Projectile)
            {
                return(TileProjectileImpact.RunImpact((Projectile)actor, gridX, gridY, dir));
            }

            if (actor is Character)
            {
                TileSolidImpact.RunImpact(actor, gridX, gridY, dir);
                return(TileCharBasicImpact.RunWallImpact((Character)actor, dir));
            }

            return(TileSolidImpact.RunImpact(actor, gridX, gridY, dir));
        }
Beispiel #6
0
        public override bool RunImpact(RoomScene room, GameObject actor, short gridX, short gridY, DirCardinal dir)
        {
            if (actor is Projectile)
            {
                return(TileProjectileImpact.RunImpact((Projectile)actor, gridX, gridY, dir));
            }

            bool collided = base.RunImpact(room, actor, gridX, gridY, dir);

            if (actor is Character)
            {
                TileCharBasicImpact.RunWallImpact((Character)actor, dir);                 // Standard Character Tile Collisions
            }

            return(collided);
        }
Beispiel #7
0
        public override bool RunImpact(RoomScene room, GameObject actor, short gridX, short gridY, DirCardinal dir)
        {
            // Actor must cross the LEFT threshold for this ledge; otherwise, it shouldn't compute any collision.
            //if(!actor.physics.CrossedThresholdLeft(gridX * (byte)TilemapEnum.TileWidth + (byte)TilemapEnum.TileWidth)) { return false; }

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

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

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

            return(collided);
        }