public void UseItem(Item item)
        {
            switch (item.Type)
            {
            case ItemType.Life:
                GiveLife();
                break;

            case ItemType.Weapon:
                ship.AddWeapon(Creator.CreateWeapon(((Weapon)item.content).type));
                break;

            default:
                break;
            }
        }
Exemple #2
0
        public static Ship CreateShip(ShipType ship, Vector2 position, Vector2 newDirection)
        {
            Ship s;    //to return

            switch (ship)
            {
            //----------------------------------------------------------------
            case ShipType.player:
                //Create Ship, load the texture, and size properties
                s = new Ship(Textures.TextureName.ShipRound);
                s.LoadContent();
                s.name = "Interceptor";
                //Positioning
                s.SetRotation(newDirection);
                s.MoveTo(position);
                //Properties and Behaviors
                s.speed = 0.3f;
                //Weapons
                s.AddWeaponPort(new Vector2(0, 18));
                s.AddWeaponPort(new Vector2(-35, 12));
                s.AddWeaponPort(new Vector2(35, 12));
                s.AddWeaponPort(new Vector2(10, -18));
                s.AddWeaponPort(new Vector2(-10, -18));
                s.AddWeaponPort(new Vector2(10, -28));
                s.AddWeaponPort(new Vector2(-10, -28));
                s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                s.AddWeapon(CreateWeapon(WeaponType.UpShooter));
                s.AddWeapon(CreateWeapon(WeaponType.UpShooter));
                //*********** DEFER ALL BEHAVIORS ... elsewhere....
                break;

            //----------------------------------------------------------------
            case ShipType.demoEnemy:
                //Create Ship, load the texture, and size properties
                s = new Ship(Textures.TextureName.ShipTriangle);
                s.LoadContent();
                s.name = "Ugly";
                //Positioning
                s.SetRotation(newDirection);
                s.MoveTo(position);
                //Properties and behaviors
                s.moveMethod = new MMDownWithin100ofCenterX();
                s.fireMethod = new FMSInterval(15, 400);
                s.speed      = 0.1f;
                s.points     = 22;
                s.health     = 2;
                //Weapons
                s.AddWeaponPort(new Vector2(28, -28));
                s.AddWeaponPort(new Vector2(-28, -28));
                //s.AddWeaponPort(new Vector2( 13,   5));
                //s.AddWeaponPort(new Vector2(-13,   5));
                s.AddWeapon(CreateWeapon(WeaponType.BasicCanon));
                s.AddWeapon(CreateWeapon(WeaponType.SideShooter));
                //s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                //s.AddWeapon(CreateWeapon(WeaponType.UpShooter));
                //s.AddWeapon(CreateWeapon(WeaponType.SideShooter));
                //s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                break;

            //----------------------------------------------------------------
            case ShipType.demoEnemy2:        //########################
                //Create Ship, load the texture, and size properties
                s = new Ship(Textures.TextureName.ShipSmall1);
                s.LoadContent();
                s.name = "SmallBlack";
                //Positioning
                s.SetRotation(newDirection);
                s.MoveTo(position);
                //Ship properties
                s.points     = 3;
                s.health     = 1;
                s.speed      = 0.1f;
                s.moveMethod = new MMSnakeFast(((double)MathHelper.ToRadians(60f) / 1000), 1000);
                s.fireMethod = new FMSasap();
                //Weapons
                s.AddWeaponPort(new Vector2(0, 10));
                s.AddWeapon(CreateWeapon(WeaponType.BasicCanon));
                return(s);


            //----------------------------------------------------------------
            case ShipType.demoEnemy3:
                //Create Ship, load the texture, and size properties
                s = new Ship(Textures.TextureName.ShipTriangle);
                s.LoadContent();
                s.name = "Ugly";
                //Positioning
                s.SetRotation(newDirection);
                s.MoveTo(position);
                //Properties and behaviors
                s.moveMethod = new MMLinear();
                s.fireMethod = new FMSInterval(50, 2000);
                s.speed      = 0.15f;
                s.points     = 22;
                s.health     = 10;
                //Weapons
                //s.AddWeaponPort(new Vector2(28, -28));
                //s.AddWeaponPort(new Vector2(-28, -28));
                s.AddWeaponPort(new Vector2(13, 5));
                s.AddWeaponPort(new Vector2(-13, 5));
                s.AddWeapon(CreateWeapon(WeaponType.BasicCanon));
                s.AddWeapon(CreateWeapon(WeaponType.BasicCanon));
                //s.AddWeapon(CreateWeapon(WeaponType.IntCanon));
                //s.AddWeapon(CreateWeapon(WeaponType.IntCanon));
                break;


            //----------------------------------------------------------------
            case ShipType.demoEnemy4:
                //Create Ship, load the texture, and size properties
                s = new Ship(Textures.TextureName.ShipSkull);
                s.LoadContent();
                s.name = "Weeeee";
                //Positioning
                s.SetRotation(newDirection);
                s.MoveTo(position);
                //Properties and behaviors
                s.moveMethod = new MMLinear();
                s.fireMethod = new FMSInterval(100, 1000);
                s.speed      = 0.1f;
                s.points     = 22;
                s.health     = 6;
                //Weapons
                s.AddWeaponPort(new Vector2(13, 5));
                s.AddWeaponPort(new Vector2(-13, 5));
                s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                break;



            //---------------Jose ADDED ---------------------------

            case ShipType.shipEnemy1:
                //Create Ship, load the texture, and size properties
                s = new Ship(Textures.TextureName.ShipEnemy1);
                s.LoadContent();
                s.name = "shipEnemy1";
                //Positioning
                s.SetRotation(newDirection);
                s.MoveTo(position);
                //Properties and behaviors

                s.moveMethod = new MMCardinalSpeedup(MMCardinalSpeedup.speedUpDir.SE, 0.4, 400);
                s.fireMethod = new FMSInterval(80, 1000);
                s.speed      = 0.1f;
                s.points     = 22;
                s.health     = 6;
                //Weapons
                s.AddWeaponPort(new Vector2(13, 5));
                s.AddWeaponPort(new Vector2(-13, 5));
                s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                break;


            case ShipType.shipEnemy2:
                //Create Ship, load the texture, and size properties
                s = new Ship(Textures.TextureName.ShipEnemy2);
                s.LoadContent();
                s.name = "shipEnemy2";
                //Positioning
                s.SetRotation(newDirection);
                s.MoveTo(position);
                //Properties and behaviors

                s.moveMethod = new MMManeuver1();
                s.fireMethod = new FMSInterval(80, 1000);
                s.speed      = 0.1f;
                s.points     = 22;
                s.health     = 6;
                //Weapons
                s.AddWeaponPort(new Vector2(13, 5));
                s.AddWeaponPort(new Vector2(-13, 5));
                s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                break;

            case ShipType.shipEnemy3:
                //Create Ship, load the texture, and size properties
                s = new Ship(Textures.TextureName.ShipEnemy3);
                s.LoadContent();
                s.name = "shipEnemy3";
                //Positioning
                s.SetRotation(newDirection);
                s.MoveTo(position);
                //Properties and behaviors

                s.moveMethod = new MMSnakeFastB(((double)MathHelper.ToRadians(60f) / 1000), 400);
                s.fireMethod = new FMSInterval(80, 1000);
                s.speed      = 0.1f;
                s.points     = 22;
                s.health     = 6;
                //Weapons
                s.AddWeaponPort(new Vector2(13, 5));
                s.AddWeaponPort(new Vector2(-13, 5));
                s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                break;



            //----------------Jose ADDED END ------------------------------------------------

            default:
                s = CreateShip(ShipType.demoEnemy, position, newDirection);
                break;
            }


            switch (Properties.difficulty)
            {
            case Difficulty.Easy:
                s.points /= 2;
                s.health /= 2;
                break;

            case Difficulty.Medium:     //standard
                break;

            case Difficulty.Hard:
                s.points = (int)(s.points * 1.5f);
                s.health = (int)(s.health * 1.5f);
                break;

            case Difficulty.Insanity:
                s.points *= 3;
                s.health *= 3;
                s.speed  *= 1.5;
                break;
            }

            return(s);
        }
        public static Ship CreateShip(ShipType ship, Vector2 position, Vector2 newDirection)
        {
            Ship s;    //to return

            switch (ship)
            {
                //----------------------------------------------------------------
                case ShipType.player:
                    //Create Ship, load the texture, and size properties
                    s = new Ship(Textures.TextureName.ShipRound);
                    s.LoadContent();
                    s.name = "Interceptor";
                    //Positioning
                    s.SetRotation(newDirection);
                    s.MoveTo(position);
                    //Properties and Behaviors
                    s.speed = 0.3f;
                    //Weapons
                    s.AddWeaponPort(new Vector2(  0, 18));
                    s.AddWeaponPort(new Vector2(-35, 12));
                    s.AddWeaponPort(new Vector2( 35, 12));
                    s.AddWeaponPort(new Vector2( 10,-18));
                    s.AddWeaponPort(new Vector2(-10,-18));
                    s.AddWeaponPort(new Vector2( 10, -28));
                    s.AddWeaponPort(new Vector2(-10, -28));
                    s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    s.AddWeapon(CreateWeapon(WeaponType.UpShooter));
                    s.AddWeapon(CreateWeapon(WeaponType.UpShooter));
                    //*********** DEFER ALL BEHAVIORS ... elsewhere....
                    break;

                //----------------------------------------------------------------
                case ShipType.demoEnemy:
                    //Create Ship, load the texture, and size properties
                    s = new Ship(Textures.TextureName.ShipTriangle);
                    s.LoadContent();
                    s.name = "Ugly";
                    //Positioning
                    s.SetRotation(newDirection);
                    s.MoveTo(position);
                    //Properties and behaviors
                    s.moveMethod = new MMDownWithin100ofCenterX();
                    s.fireMethod = new FMSInterval(15, 400);
                    s.speed = 0.1f;
                    s.points = 22;
                    s.health = 2;
                    //Weapons
                    s.AddWeaponPort(new Vector2( 28, -28));
                    s.AddWeaponPort(new Vector2(-28, -28));
                    //s.AddWeaponPort(new Vector2( 13,   5));
                    //s.AddWeaponPort(new Vector2(-13,   5));
                    s.AddWeapon(CreateWeapon(WeaponType.BasicCanon));
                    s.AddWeapon(CreateWeapon(WeaponType.SideShooter));
                    //s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    //s.AddWeapon(CreateWeapon(WeaponType.UpShooter));
                    //s.AddWeapon(CreateWeapon(WeaponType.SideShooter));
                    //s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    break;

                //----------------------------------------------------------------
                case ShipType.demoEnemy2:    //########################
                    //Create Ship, load the texture, and size properties
                    s = new Ship(Textures.TextureName.ShipSmall1);
                    s.LoadContent();
                    s.name = "SmallBlack";
                    //Positioning
                    s.SetRotation(newDirection);
                    s.MoveTo(position);
                    //Ship properties
                    s.points = 3;
                    s.health = 1;
                    s.speed = 0.1f;
                    s.moveMethod = new MMSnakeFast(((double)MathHelper.ToRadians(60f) / 1000), 1000);
                    s.fireMethod = new FMSasap();
                    //Weapons
                    s.AddWeaponPort(new Vector2(0, 10));
                    s.AddWeapon(CreateWeapon(WeaponType.BasicCanon));
                    return s;

                //----------------------------------------------------------------
                case ShipType.demoEnemy3:
                    //Create Ship, load the texture, and size properties
                    s = new Ship(Textures.TextureName.ShipTriangle);
                    s.LoadContent();
                    s.name = "Ugly";
                    //Positioning
                    s.SetRotation(newDirection);
                    s.MoveTo(position);
                    //Properties and behaviors
                    s.moveMethod = new MMLinear();
                    s.fireMethod = new FMSInterval(50, 2000);
                    s.speed = 0.15f;
                    s.points = 22;
                    s.health = 10;
                    //Weapons
                    //s.AddWeaponPort(new Vector2(28, -28));
                    //s.AddWeaponPort(new Vector2(-28, -28));
                    s.AddWeaponPort(new Vector2(13, 5));
                    s.AddWeaponPort(new Vector2(-13, 5));
                    s.AddWeapon(CreateWeapon(WeaponType.BasicCanon));
                    s.AddWeapon(CreateWeapon(WeaponType.BasicCanon));
                    //s.AddWeapon(CreateWeapon(WeaponType.IntCanon));
                    //s.AddWeapon(CreateWeapon(WeaponType.IntCanon));
                    break;

                //----------------------------------------------------------------
                case ShipType.demoEnemy4:
                    //Create Ship, load the texture, and size properties
                    s = new Ship(Textures.TextureName.ShipSkull);
                    s.LoadContent();
                    s.name = "Weeeee";
                    //Positioning
                    s.SetRotation(newDirection);
                    s.MoveTo(position);
                    //Properties and behaviors
                    s.moveMethod = new MMLinear();
                    s.fireMethod = new FMSInterval(100,1000);
                    s.speed = 0.1f;
                    s.points = 22;
                    s.health = 6;
                    //Weapons
                    s.AddWeaponPort(new Vector2(13, 5));
                    s.AddWeaponPort(new Vector2(-13, 5));
                    s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    break;

                //---------------Jose ADDED ---------------------------

                case ShipType.shipEnemy1:
                    //Create Ship, load the texture, and size properties
                    s = new Ship(Textures.TextureName.ShipEnemy1);
                    s.LoadContent();
                    s.name = "shipEnemy1";
                    //Positioning
                    s.SetRotation(newDirection);
                    s.MoveTo(position);
                    //Properties and behaviors

                    s.moveMethod = new MMCardinalSpeedup(MMCardinalSpeedup.speedUpDir.SE, 0.4, 400);
                    s.fireMethod = new FMSInterval(80, 1000);
                    s.speed = 0.1f;
                    s.points = 22;
                    s.health = 6;
                    //Weapons
                    s.AddWeaponPort(new Vector2(13, 5));
                    s.AddWeaponPort(new Vector2(-13, 5));
                    s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    break;

                case ShipType.shipEnemy2:
                    //Create Ship, load the texture, and size properties
                    s = new Ship(Textures.TextureName.ShipEnemy2);
                    s.LoadContent();
                    s.name = "shipEnemy2";
                    //Positioning
                    s.SetRotation(newDirection);
                    s.MoveTo(position);
                    //Properties and behaviors

                    s.moveMethod = new MMManeuver1();
                    s.fireMethod = new FMSInterval(80, 1000);
                    s.speed = 0.1f;
                    s.points = 22;
                    s.health = 6;
                    //Weapons
                    s.AddWeaponPort(new Vector2(13, 5));
                    s.AddWeaponPort(new Vector2(-13, 5));
                    s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    break;

                case ShipType.shipEnemy3:
                    //Create Ship, load the texture, and size properties
                    s = new Ship(Textures.TextureName.ShipEnemy3);
                    s.LoadContent();
                    s.name = "shipEnemy3";
                    //Positioning
                    s.SetRotation(newDirection);
                    s.MoveTo(position);
                    //Properties and behaviors

                    s.moveMethod = new MMSnakeFastB(((double)MathHelper.ToRadians(60f) / 1000), 400);
                    s.fireMethod = new FMSInterval(80, 1000);
                    s.speed = 0.1f;
                    s.points = 22;
                    s.health = 6;
                    //Weapons
                    s.AddWeaponPort(new Vector2(13, 5));
                    s.AddWeaponPort(new Vector2(-13, 5));
                    s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    s.AddWeapon(CreateWeapon(WeaponType.TripleCanon));
                    break;

                //----------------Jose ADDED END ------------------------------------------------

                default:
                    s = CreateShip(ShipType.demoEnemy, position, newDirection);
                    break;
            }

            switch (Properties.difficulty)
            {
                case Difficulty.Easy:
                    s.points /= 2;
                    s.health /= 2;
                    break;

                case Difficulty.Medium: //standard
                    break;

                case Difficulty.Hard:
                    s.points = (int)(s.points * 1.5f);
                    s.health = (int)(s.health * 1.5f);
                    break;

                case Difficulty.Insanity:
                    s.points *= 3;
                    s.health *= 3;
                    s.speed *= 1.5;
                    break;
            }

            return s;
        }