Пример #1
0
        public static ProjectileBullet Create(RoomScene room, byte subType, FVector pos, FVector velocity)
        {
            // Retrieve an available projectile from the pool.
            ProjectileBullet projectile = ProjectilePool.ProjectileBullet.GetObject();

            projectile.ResetProjectile(room, subType, pos, velocity);
            projectile.SetSafelyJumpOnTop(true);
            projectile.SetEndLife(Systems.timer.Frame + 720);
            projectile.AssignBoundsByAtlas(2, 2, -2, -2);

            // Add the Projectile to Scene
            room.AddToScene(projectile, false);

            return(projectile);
        }
Пример #2
0
        public override void ActivateCannon(RoomScene room, byte subType, short gridX, short gridY, byte cannonSpeed)
        {
            FVector pos        = FVector.Create(gridX * (byte)TilemapEnum.TileWidth + Cannon.xOffset, gridY * (byte)TilemapEnum.TileHeight + Cannon.xOffset);
            FInt    angleSpeed = FInt.Create(cannonSpeed * 0.707);

            // Left
            if (subType == (byte)CannonHorSubType.Left)
            {
                pos.X -= 30;
                ProjectileBullet.Create(room, (byte)0, pos, FVector.Create(0 - angleSpeed, FInt.Create(0)));
            }

            // Right
            else
            {
                pos.X += 30;
                ProjectileBullet.Create(room, (byte)0, pos, FVector.Create(angleSpeed, FInt.Create(0)));
            }

            room.PlaySound(Systems.sounds.cannonFire, 1f, gridX * (byte)TilemapEnum.TileWidth, gridY * (byte)TilemapEnum.TileHeight);
        }
Пример #3
0
        public override void ActivateCannon(RoomScene room, byte subType, short gridX, short gridY, byte cannonSpeed)
        {
            FVector pos        = FVector.Create(gridX * (byte)TilemapEnum.TileWidth + Cannon.xOffset, gridY * (byte)TilemapEnum.TileHeight + Cannon.xOffset);
            FInt    angleSpeed = FInt.Create(cannonSpeed * 0.707);

            // Up Right
            if (subType == (byte)CannonDiagSubType.UpRight)
            {
                pos.X += 18;
                pos.Y -= 18;
                ProjectileBullet.Create(room, (byte)0, pos, FVector.Create(angleSpeed, 0 - angleSpeed));
            }

            // Down Right
            else if (subType == (byte)CannonDiagSubType.DownRight)
            {
                pos.X += 16;
                pos.Y += 19;
                ProjectileBullet.Create(room, (byte)0, pos, FVector.Create(angleSpeed, angleSpeed));
            }

            // Down Left
            else if (subType == (byte)CannonDiagSubType.DownLeft)
            {
                pos.X -= 17;
                pos.Y += 19;
                ProjectileBullet.Create(room, (byte)0, pos, FVector.Create(0 - angleSpeed, angleSpeed));
            }

            // Up Left
            else
            {
                pos.X -= 17;
                pos.Y -= 20;
                ProjectileBullet.Create(room, (byte)0, pos, FVector.Create(0 - angleSpeed, 0 - angleSpeed));
            }

            room.PlaySound(Systems.sounds.cannonFire, 1f, gridX * (byte)TilemapEnum.TileWidth, gridY * (byte)TilemapEnum.TileHeight);
        }