Esempio n. 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public SpanishShop(PDVehicle player)
            : base("Spanish trader")
        {
            m_playerVehicle = player;

            // Create our menu entries.
            m_rum     = new MenuEntry(string.Empty);
            m_leather = new MenuEntry(string.Empty);

            m_rum.Selected     += RumSelected;
            m_leather.Selected += LeatherSelected;

            MenuEntry back = new MenuEntry("Back");

            back.Selected += OnCancel;

            MenuEntries.Add(m_rum);
            MenuEntries.Add(m_leather);
            MenuEntries.Add(back);

            SetMenuEntryText();

            Game1.Audio.SetParameter("ambience", "Interactive_Ambience", Game1.AMBIENCE_HARBOR);
            Game1.Audio.SetParameter("music", "Interactive_Sounds", Game1.MUSIC_HARBOR);

            MenuScreen.bPlayNext = false;
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public ChineseShop(PDVehicle player)
            : base("Chinese trader")
        {
            m_playerVehicle = player;

            // Create our menu entries.
            m_spices = new MenuEntry(string.Empty);
            m_silk   = new MenuEntry(string.Empty);

            m_spices.Selected += SpicesSelected;
            m_silk.Selected   += SilkSelected;

            MenuEntry back = new MenuEntry("Back");

            back.Selected += OnCancel;

            MenuEntries.Add(m_spices);
            MenuEntries.Add(m_silk);
            MenuEntries.Add(back);

            SetMenuEntryText();

            Game1.Audio.SetParameter("ambience", "Interactive_Ambience", Game1.AMBIENCE_HARBOR);
            Game1.Audio.SetParameter("music", "Interactive_Sounds", Game1.MUSIC_HARBOR);


            MenuScreen.bPlayNext = false;
        }
Esempio n. 3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public PersianShop(PDVehicle player)
            : base("Pirate shop")
        {
            m_playerVehicle = player;

            // Create our menu entries.
            m_tools = new MenuEntry(string.Empty);
            m_rope  = new MenuEntry(string.Empty);

            m_tools.Selected += ToolsSelected;
            m_rope.Selected  += RopeSelected;

            MenuEntry back = new MenuEntry("Back");

            back.Selected += OnCancel;

            MenuEntries.Add(m_tools);
            MenuEntries.Add(m_rope);
            MenuEntries.Add(back);

            SetMenuEntryText();

            Game1.Audio.SetParameter("ambience", "Interactive_Ambience", Game1.AMBIENCE_HARBOR);
            Game1.Audio.SetParameter("music", "Interactive_Sounds", Game1.MUSIC_HARBOR);

            MenuScreen.bPlayNext = false;
        }
Esempio n. 4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public PirateShop(PDVehicle player)
            : base("Pirate shop")
        {
            m_playerVehicle = player;

            // Create our menu entries.
            m_upgradeArmor   = new MenuEntry(string.Empty);
            m_upgradeBalls   = new MenuEntry(string.Empty);
            m_upgradeCannons = new MenuEntry(string.Empty);
            m_upgradeSpeed   = new MenuEntry(string.Empty);
            m_repair         = new MenuEntry(string.Empty);

            m_upgradeSpeed.Selected   += SpeedSelected;
            m_upgradeCannons.Selected += CannonsSelected;
            m_upgradeBalls.Selected   += BallsSelected;
            m_upgradeArmor.Selected   += ArmorSelected;
            m_repair.Selected         += RepairSelected;

            MenuEntry back = new MenuEntry("Back");

            back.Selected += OnCancel;

            MenuEntries.Add(m_upgradeArmor);
            MenuEntries.Add(m_upgradeSpeed);
            MenuEntries.Add(m_upgradeBalls);
            MenuEntries.Add(m_upgradeCannons);
            MenuEntries.Add(m_repair);
            MenuEntries.Add(back);

            SetMenuEntryText();

            Game1.Audio.SetParameter("ambience", "Interactive_Ambience", Game1.AMBIENCE_HARBOR);
            Game1.Audio.SetParameter("music", "Interactive_Sounds", Game1.MUSIC_HARBOR);

            MenuScreen.bPlayNext = false;
        }
Esempio n. 5
0
        public override void Update(GameTime gameTime)
        {
            // Set the correct animation based on Velocity/Throttle & Rotation

            // Lean percentage that increases when you hold down turning and normalizes when you don't
            // The Lean percentage is adjusted by velocity/throttle so that you can't lean hard with low velocity

            if (m_health <= 0)
            {
                bDead = true;
                // Cue c = Game1.Audio.PlaySound("sfx_ship_sink");
                Cue           c  = Game1.Audio.GetCue("sfx_ship_sink");
                AudioListener al = new AudioListener();
                al.Position = new Vector3(m_screen.Player.Position, 0);
                al.Up       = Vector3.Backward;
                al.Forward  = Vector3.Up;

                AudioEmitter ae = new AudioEmitter();
                ae.Position = new Vector3(Position, 0);
                ae.Up       = Vector3.Backward;
                ae.Forward  = Vector3.Up;

                c.Apply3D(al, ae);
                Game1.Audio.PlayCue(c);


                c.SetVariable("Distance", (Screen.Player.Position - Position).Length());

                Wreckage w = new Wreckage(Game);
                w.Initialize(m_gold, Silk, Spices, Leather, Rum, Iron, Coal, Rope, Tools);
                w.Position = Position;

                for (int i = 0; i < 10; i++)
                {
                    EffectCannonFire a = new EffectCannonFire(Game);
                    a.Initialize(10, Position + new Vector2(Game1.Rand.Next(-40, 40), Game1.Rand.Next(-40, 40)), true);
                }

                for (int i = 0; i < 10; i++)
                {
                    Watersplash a = new Watersplash(Game);
                    a.Initialize(10, Position + new Vector2(Game1.Rand.Next(-40, 40), Game1.Rand.Next(-40, 40)), true);
                }

                int n = Game1.Rand.Next(0, GameplayScreen.m_waypoints.Length);

                int type = Game1.Rand.Next(0, 4);

                PDVehicle v = null;

                switch (type)
                {
                case 0:
                    v = new PDVBritish(Game, m_screen);
                    v.Initialize();
                    v.SetDefaultGraphics(ref GameplayScreen.m_tShipBritish);
                    break;

                case 1:
                    v = new PDVChinese(Game, m_screen);
                    v.Initialize();
                    v.SetDefaultGraphics(ref GameplayScreen.m_tShipChinese);
                    break;

                case 2:
                    v = new PDVPersian(Game, m_screen);
                    v.Initialize();
                    v.SetDefaultGraphics(ref GameplayScreen.m_tShipPersian);
                    break;

                case 3:
                    v = new PDVSpanish(Game, m_screen);
                    v.Initialize();
                    v.SetDefaultGraphics(ref GameplayScreen.m_tShipSpanish);
                    break;
                }

                v.Position         = GameplayScreen.m_waypoints[n];
                v.ThrottleMax      = 40;
                v.ThrottleDecrease = 100;
                v.bTurnInPlace     = true;


                return;
            }



            for (int i = 0; i < Screen.m_islands.Count; i++)
            {
                if (Screen.m_islands[i].Hitbox != null)
                {
                    for (int j = 0; j < Screen.m_islands[i].Hitbox.Length; j++)
                    {
                        if (Screen.m_islands[i].Hitbox[j].TestOBBOBB(Obb))
                        {
                            // Cue c = Game1.Audio.PlaySound("sfx_ship_collide");
                            Cue           c  = Game1.Audio.GetCue("sfx_ship_collide");
                            AudioListener al = new AudioListener();
                            al.Position = new Vector3(m_screen.Player.Position, 0);
                            al.Up       = Vector3.Backward;
                            al.Forward  = Vector3.Up;

                            AudioEmitter ae = new AudioEmitter();
                            ae.Position = new Vector3(Position, 0);
                            ae.Up       = Vector3.Backward;
                            ae.Forward  = Vector3.Up;

                            c.Apply3D(al, ae);
                            Game1.Audio.PlayCue(c);


                            c.SetVariable("Distance", (Screen.Player.Position - Position).Length());


                            Vector2 v = Obb.Center - Screen.m_islands[i].Hitbox[j].Center;
                            v.Normalize();

                            Heading  = v;
                            Rotation = (float)Math.Atan2(Heading.Y, Heading.X);
                            Throttle = 100;
                            break;
                        }
                    }
                }
            }



            // Throttle -= ThrottleDecrease * (float)gameTime.ElapsedGameTime.TotalSeconds * 0.25f;

            float velMod = 0.0f;

            if (Throttle > 0.001f)
            {
                velMod = Throttle / ThrottleMax;
            }

            m_leanValue = MathHelper.Clamp(m_leanValue * velMod, -1.0f, 1.0f);

            int index = (int)Math.Round(m_leanValue * 4.0f) + 4;

            if (m_gfx != null)
            {
                if ((m_gfx as Animation).ActiveAnimationSet.Name != m_animTable[index])
                {
                    int currentFrame = (m_gfx as Animation).ActiveAnimationSet.nActiveFrame;
                    (m_gfx as Animation).SetActiveSet(m_animTable[index], currentFrame);
                }
            }


            if (m_bFiring)
            {
                if (m_nextShot < gameTime.TotalGameTime.TotalSeconds)
                {
                    Fire(gameTime);
                    m_nextShot += m_tTimeBetweenShots;

                    if (m_cannonsReady <= 0)
                    {
                        m_bFiring = false;
                    }
                }
            }
            else
            {
                Reload(gameTime);
            }



            m_obb.Orientation = Rotation;
            m_obb.Center      = Position;
            m_obb.CalculateAxis();

            m_shadow.Position = Position;
            m_shadow.Rotation = Rotation;

            m_hpBar.Position = Position;
            m_hpBar.Update(gameTime);
            m_hpBar.Scale = new Vector2(m_health / m_maxHealth, 1);

            m_hpBarBG.Position = Position;

            m_hpBarBG.Update(gameTime);



            if (m_tNextWaterTrail < gameTime.TotalGameTime.TotalSeconds)
            {
                if (Throttle > 10.0f)
                {
                    EffectWaterTrail water = new EffectWaterTrail(Game);
                    water.Initialize((float)gameTime.TotalGameTime.TotalSeconds + 3.5f, Position + (Heading * 40), false);
                    water.Rotation = Rotation - MathHelper.PiOver2;

                    water = new EffectWaterTrail(Game);
                    water.Initialize((float)gameTime.TotalGameTime.TotalSeconds + 3.5f, Position + (Heading * 40), false);
                    water.Rotation = Rotation + MathHelper.PiOver2;

                    m_tNextWaterTrail = (float)gameTime.TotalGameTime.TotalSeconds + 0.1f;
                }
            }



            base.Update(gameTime);
        }