示例#1
0
        public Pax4UiStateLavaAndIceMission(String p_name, Pax4Ui p_ui, Pax4WorldLavaAndIce.ELavaAndIceMissionType p_missionType = Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
            : base(p_name, p_ui)
        {
            //_blendState = BlendState.AlphaBlend;

            String     textureName = null;
            Texture2D  texture     = null;
            Pax4Sprite sprite      = null;
            Pax4Sprite scoreSprite = null;
            Vector2    position;

            float duration = 0.3f;
            //float delay = 0.0f;
            Pax4SpriteColorModifier colorModifierEnter = new Pax4SpriteColorModifier("", null);

            colorModifierEnter.Ini(Color.Black, Color.White, duration);
            AddStateEnterModifier(colorModifierEnter);
            Pax4SpriteColorModifier colorModifierExit = new Pax4SpriteColorModifier("", null);

            colorModifierExit.Ini(Color.White, Color.Black, duration);
            AddStateExitModifier(colorModifierExit);

            Pax4SpriteAlphaModifier alphaModifierEnter = new Pax4SpriteAlphaModifier("", null);

            alphaModifierEnter.Ini(0.0f, 1.0f, duration);
            AddStateEnterModifier(alphaModifierEnter);
            Pax4SpriteAlphaModifier alphaModifierExit = new Pax4SpriteAlphaModifier("", null);

            alphaModifierExit.Ini(1.0f, 0.0f, duration);
            AddStateExitModifier(alphaModifierExit);

            //Pax4SpriteColorModifier colorModifier = null;
            //Pax4SpriteAlphaModifier alphaModifier = null;
            Pax4SpritePositionModifier positionModifier = null;
            //Pax4SpriteTextModifier textModifier = null;
            Pax4SpriteTextNumberModifier textNumberModifier = null;

            position.X  = 0.1f;
            position.Y  = 0.1f;
            textureName = "Sprite/lavaandiceInGameFgScore";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("top", null);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(position);
            AddChild(sprite);
            scoreSprite = sprite;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            textureName = "Sprite/lavaandiceInGameFgBottom";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("bottom", null);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            position.X = 0.1f;
            position.Y = 0.2f;
            sprite.SetPosition(position);
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            position.Y = 0.3f;
            position.X = 0.4f;

            if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA || p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
            {
                textureName = "Sprite/lavaandiceInGameFgLavaLauncher";
                texture     = Pax4Texture2D._current.Get(textureName);
                sprite      = new Pax4ToggleButton("lavaLauncher", null);
                ((Pax4SpriteTexture)sprite).SetTexture(texture);

                textureName = "Sprite/lavaandiceInGameFgLavaLauncherOver";
                texture     = Pax4Texture2D._current.Get(textureName);
                ((Pax4ToggleButton)sprite).SetTextureOver(texture);

                ((Pax4ToggleButton)sprite).SetOnClick(lavaandiceLavaLauncher_Click);
                ((Pax4ToggleButton)sprite).ToggleEnabled(false);

                _lavaLauncher = (Pax4ToggleButton)sprite;

                //if (Pax4Camera._backBufferWidth > 480)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 127.0f;
                //}
                //else if (Pax4Camera._backBufferWidth == 480)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 130.0f;
                //}
                //else if (Pax4Camera._backBufferWidth <= 320)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 137.0f;
                //}
                sprite.SetPosition(position);
                AddChild(sprite);
                colorModifierEnter.AddChild(sprite);
                colorModifierExit.AddChild(sprite);
                alphaModifierEnter.AddChild(sprite);
                alphaModifierExit.AddChild(sprite);
            }

            if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._ICE || p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
            {
                textureName = "Sprite/lavaandiceInGameFgIceLauncher";
                texture     = Pax4Texture2D._current.Get(textureName);
                sprite      = new Pax4ToggleButton("iceLauncher", null);
                ((Pax4SpriteTexture)sprite).SetTexture(texture);

                textureName = "Sprite/lavaandiceInGameFgIceLauncherOver";
                texture     = Pax4Texture2D._current.Get(textureName);
                ((Pax4ToggleButton)sprite).SetTextureOver(texture);

                ((Pax4ToggleButton)sprite).SetOnClick(lavaandiceIceLauncher_Click);
                ((Pax4ToggleButton)sprite).ToggleEnabled(false);

                _iceLauncher = (Pax4ToggleButton)sprite;

                //position.X = 0.4;

                //if (Pax4Camera._backBufferWidth > 480)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 263.0f;
                //}
                //else if (Pax4Camera._backBufferWidth == 480)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 260.0f;
                //}
                //else if (Pax4Camera._backBufferWidth <= 320)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 253.0f;
                //}
                sprite.SetPosition(position);
                AddChild(sprite);
                colorModifierEnter.AddChild(sprite);
                colorModifierExit.AddChild(sprite);
                alphaModifierEnter.AddChild(sprite);
                alphaModifierExit.AddChild(sprite);
            }

            textureName = "Sprite/lavaandiceInGameMenuBtn";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4Button("menu", null);
            ((Pax4Button)sprite).SetTexture(texture);
            position.X = 0.7f;
            position.Y = 0.1f;
            sprite.SetPosition(position);
            textureName = "Sprite/lavaandiceInGameMenuBtnOver";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4Button)sprite).SetTextureOver(texture);
            ((Pax4Button)sprite).SetOnClick(this.lavaandiceMenuBtn_Click);
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            textureName = "Sprite/lavaandiceInGamePauseBtn";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4ToggleButton("pause", null);
            ((Pax4Button)sprite).SetTexture(texture);
            position.X = 0.3f;
            position.Y = 0.3f;
            sprite.SetPosition(position);
            textureName = "Sprite/lavaandiceInGamePauseBtnOver";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4Button)sprite).SetTextureOver(texture);
            ((Pax4Button)sprite).SetOnClick(this.lavaandicePauseBtn_Click);
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //position.X = -20.0f;
            //position.Y = 45.0f;
            position.X = 64.0f;
            position.Y = 47.0f;
            sprite     = new Pax4UiLavaAndIceMissionThermometer("thermometer", null);
            sprite.SetPosition(position);
            AddChild(sprite);

            position.X = 0.0f;
            position.Y = 0.0f;
            sprite     = new Pax4UiLavaAndIceMissionHealth("health", null);
            sprite.SetPosition(position);
            AddChild(sprite);

            position.X = 8.0f;
            position.Y = 52.0f;
            sprite     = new Pax4UiLavaAndIceMissionTimer("timer", null);
            sprite.SetPosition(position);
            AddChild(sprite);
            _missionTimer = (Pax4UiLavaAndIceMissionTimer)sprite;

            Vector2 position1 = new Vector2(-150, 52);

            position1 *= Pax4Camera._current._scale2;

            position        *= Pax4Camera._current._scale2;
            positionModifier = new Pax4SpritePositionModifier("", null);
            positionModifier.Ini(position1, position, 0.2f);
            positionModifier.AddChild(sprite);
            AddStateEnterModifier(positionModifier);

            position        *= Pax4Camera._current._scale2;
            positionModifier = new Pax4SpritePositionModifier("", null);
            positionModifier.AddChild(sprite);
            positionModifier.Ini(position, position1, 0.2f);
            AddStateExitModifier(positionModifier);

            //**************************************************
            //create text sprites
            //**************************************************
            float xpos = 0.0f;
            //float xstep = 0.0f;
            //float xoff = 0.0f;

            float ypos  = 0.0f;
            float ystep = 0.0f;
            //float yoff = 0.0f;

            float scale;

            //Score
            xpos       = 91.0f;
            ypos       = 4.0f;
            ystep      = 22.0f;
            sprite     = new Pax4SpriteText("score", scoreSprite);
            position.X = xpos;
            position.Y = ypos; ypos += ystep;
            scale      = 0.40f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("Score:");
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //Score value
            xpos       = 145.0f;
            ypos       = 4.0f;
            sprite     = new Pax4SpriteText("scoreValue", scoreSprite);
            position.X = xpos;
            position.Y = ypos; ypos += ystep;
            scale      = 0.45f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("0");
            AddChild(sprite);
            _scoreSprite = sprite;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            textNumberModifier = new Pax4SpriteTextNumberModifier("", null);
            textNumberModifier.AddChild(sprite);
            AddStateEnterModifier(textNumberModifier);
            _scoreSpriteModifier = textNumberModifier;

            //High Score
            xpos       = 81.0f;
            sprite     = new Pax4SpriteText("highScore", scoreSprite);
            position.X = xpos;
            position.Y = ypos;
            scale      = 0.35f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("High Score:");
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //High Score value
            xpos       = 161.0f;
            ypos       = ypos - 1.0f;
            sprite     = new Pax4SpriteText("highScoreValue", scoreSprite);
            position.X = xpos;
            position.Y = ypos;
            scale      = 0.40f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("0");
            AddChild(sprite);
            _highScoreSprite = sprite;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //**************************************************
            //create medal sprites
            //**************************************************
            if (_medalSprite == null)
            {
                _medalSprite = new Dictionary <String, Pax4Sprite>();
            }
            else
            {
                return;
            }

            Dictionary <String, String> _medal = new Dictionary <String, String>();

            _medal.Add("nightmareOn", "Sprite/lavaandiceNightmareOn");
            //_medal.Add("nightmareOff", "Sprite/lavaandiceNightmareOff");
            _medal.Add("hardOn", "Sprite/lavaandiceHardOn");
            //_medal.Add("hardOff", "Sprite/lavaandiceHardOff");
            _medal.Add("normalOn", "Sprite/lavaandiceNormalOn");
            //_medal.Add("normalOff", "Sprite/lavaandiceNormalOff");
            _medal.Add("easyOn", "Sprite/lavaandiceEasyOn");
            //_medal.Add("easyOff", "Sprite/lavaandiceEasyOff");

            xpos = 251.0f;
            ypos = 2.0f;
            foreach (KeyValuePair <String, String> kvp in _medal)
            {
                textureName = kvp.Value;
                texture     = Pax4Texture2D._current.Get(textureName);
                sprite      = new Pax4SpriteTexture(kvp.Key, scoreSprite);
                ((Pax4SpriteTexture)sprite).SetTexture(texture);
                sprite.SetPosition(new Vector2(xpos, ypos));
                _medalSprite.Add(sprite._name, sprite);
                colorModifierEnter.AddChild(sprite);
                colorModifierExit.AddChild(sprite);
                alphaModifierEnter.AddChild(sprite);
                alphaModifierExit.AddChild(sprite);
            }

            _currentMedalSprite = sprite;
        }
示例#2
0
        public Pax4UiLavaAndIceMissionHealth(String p_name, Pax4Sprite p_parent)
            : base(p_name, p_parent)
        {
            _currentHealth = this;

            _sprite = new Dictionary <String, Pax4Sprite>();

            String     textureName = null;
            Texture2D  texture     = null;
            Pax4Sprite sprite      = null;

            #region lavaHealth

            textureName = "Sprite/lavaandiceLavaHealth0";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("lava0", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(_lavaHealthSpritePosition);
            _sprite.Add(sprite._name, sprite);

            _currentLavaHealthSprite = (Pax4SpriteTexture)sprite;

            textureName = "Sprite/lavaandiceLavaHealth1";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("lava1", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(_lavaHealthSpritePosition);
            _sprite.Add(sprite._name, sprite);

            textureName = "Sprite/lavaandiceLavaHealth2";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("lava2", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(_lavaHealthSpritePosition);
            _sprite.Add(sprite._name, sprite);

            textureName = "Sprite/lavaandiceLavaHealth3";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("lava3", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(_lavaHealthSpritePosition);
            _sprite.Add(sprite._name, sprite);

            #endregion

            #region iceHealth

            textureName = "Sprite/lavaandiceIceHealth0";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("ice0", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(_iceHealthSpritePosition);
            _sprite.Add(sprite._name, sprite);

            _currentIceHealthSprite = (Pax4SpriteTexture)sprite;

            textureName = "Sprite/lavaandiceIceHealth1";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("ice1", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(_iceHealthSpritePosition);
            _sprite.Add(sprite._name, sprite);

            textureName = "Sprite/lavaandiceIceHealth2";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("ice2", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(_iceHealthSpritePosition);
            _sprite.Add(sprite._name, sprite);

            textureName = "Sprite/lavaandiceIceHealth3";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("ice3", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(_iceHealthSpritePosition);
            _sprite.Add(sprite._name, sprite);

            #endregion
        }
示例#3
0
        public void UpdateTemperature(GameTime gameTime)
        {
            _temperature = _defaultTemperature;

            _temperatureStep = 1.0f / (Pax4ActorEnemyAmmoLava._current.Count + Pax4ActorEnemyAmmoIce._current.Count);

            _temperature = _defaultTemperature + _temperatureStep * (float)(Pax4ActorEnemyAmmoLava._current.Count - Pax4ActorEnemyAmmoIce._current.Count);

            if (Pax4ActorEnemyMonsterLava._current != null)
            {
                if (_temperature <= 0.25f)
                {
                    //_monsterLava.DisableBoneAuraParticleEffect();
                    Pax4ActorEnemyMonsterLava._current.SetShieldDown();
                }
                else if (_temperature > 0.25f && Pax4ActorEnemyMonsterLava._current._shieldDown)
                {
                    //_monsterLava.EnableBoneAuraParticleEffect();
                    Pax4ActorEnemyMonsterLava._current.SetShieldDown(false);
                }

                Pax4UiLavaAndIceMissionHealth.SetLavaHealth(Pax4ActorEnemyMonsterLava._current._health);
            }
            else
            {
                Pax4UiLavaAndIceMissionHealth.SetLavaHealth(0.0f);
            }

            if (Pax4ActorEnemyMonsterIce._current != null)
            {
                if (_temperature >= 0.75f)
                {
                    //_monsterIce.DisableBoneAuraParticleEffect();
                    Pax4ActorEnemyMonsterIce._current.SetShieldDown();
                }
                else if (_temperature < 0.75f && Pax4ActorEnemyMonsterIce._current._shieldDown)
                {
                    //_monsterIce.EnableBoneAuraParticleEffect();
                    Pax4ActorEnemyMonsterIce._current.SetShieldDown(false);
                }

                Pax4UiLavaAndIceMissionHealth.SetIceHealth(Pax4ActorEnemyMonsterIce._current._health);
            }
            else
            {
                Pax4UiLavaAndIceMissionHealth.SetIceHealth(0.0f);
            }

            Pax4UiLavaAndIceMissionThermometer.SetTemperature(_temperature);

            if (_autoBalance)
            {
                Pax4Actor actor = null;
                int       nextAvailableWayPointPathIndex = GetNextAvailableWayPointPathIndex();

                if (_temperature < _midTemperatureThreshold)
                {
                    //add random power-ups to 20% of created enemy ammo
                    if (Pax4ActorEnemyMonsterLava._current != null && nextAvailableWayPointPathIndex >= 0)
                    {
                        actor = new Pax4ActorEnemyAmmoLava(_lavaIndex.ToString(), null, _lavaIndex);
                        actor.MoveTo(Vector3.Zero, Pax4ActorEnemyMonsterLava._current._body.Position);
                    }
                }
                else if (_temperature > _midTemperatureThreshold)
                {
                    //add random power-ups to 20% of created enemy ammo
                    if (Pax4ActorEnemyMonsterIce._current != null && nextAvailableWayPointPathIndex >= 0)
                    {
                        actor = new Pax4ActorEnemyAmmoIce(_iceIndex.ToString(), null, _iceIndex);
                        actor.MoveTo(Vector3.Zero, Pax4ActorEnemyMonsterIce._current._body.Position);
                    }
                }

                if (actor != null)
                {
                    new Pax4WayPointControllerActor(actor, 2.0f, _wayPointPath[nextAvailableWayPointPathIndex], _wayPointPath[nextAvailableWayPointPathIndex].GetRandomWayPointIndex());
                    actor.Enable();
                }

                if (_temperature >= 0.48f && _temperature <= 0.52f)
                {
                    _autoBalance = false;
                }
            }
        }