Exemple #1
0
        public void PopulateWithActors(List <Pax4ObjectPhysicsPart> p_result            = null,
                                       EPopulateWithActorsType p_populateWithActorsType = EPopulateWithActorsType._HETEROGENEOUS,
                                       bool p_lava = true,
                                       Pax4WayPointPathList p_wayPointPaths = null,
                                       float p_velocityFactor = 1.0f)
        {
            List <Pax4WayPointPath> wayPointPathList = null;

            if (p_wayPointPaths != null)
            {
                wayPointPathList = p_wayPointPaths._wayPointPath;
            }
            else
            {
                wayPointPathList = _wayPointPath;
            }

            if (wayPointPathList.Count <= 0)
            {
                return;
            }

            if (p_result != null)
            {
                p_result.Clear();
            }

            Pax4WayPointPath wayPointPath = null;
            Pax4Actor        actor        = null;

            int half       = wayPointPathList.Count / 2;
            int halfLength = half;

            for (int wi = 0; wi < wayPointPathList.Count; wi++)
            {
                wayPointPath = wayPointPathList[wi];

                if (p_wayPointPaths == null)
                {
                    halfLength = wayPointPath._wayPoint.Length / 2;
                }

                if (wayPointPath._residentCount != 0) //this allows for multipe calls to PopulateWithActors for the glorious benefit of waves after wave after wave
                {
                    continue;
                }

                if (wayPointPath._locked)
                {
                    if (Pax4WorldLavaAndIce._missionType == ELavaAndIceMissionType._LAVA ||
                        Pax4WorldLavaAndIce._missionType == ELavaAndIceMissionType._LAVA_AND_ICE &&
                        Pax4ActorEnemyMonsterIce._current == null)
                    {
                        Pax4ActorEnemyMonsterIce monsterIce = new Pax4ActorEnemyMonsterIce(_iceIndex.ToString(), null, _iceIndex);
                        monsterIce.MoveTo(Vector3.Zero, wayPointPath._wayPoint[0]);
                        new Pax4WayPointControllerActor(monsterIce, _difficulty, wayPointPath);
                        monsterIce.Enable();
                        continue;
                    }
                    else if (Pax4WorldLavaAndIce._missionType == ELavaAndIceMissionType._ICE ||
                             Pax4WorldLavaAndIce._missionType == ELavaAndIceMissionType._LAVA_AND_ICE &&
                             Pax4ActorEnemyMonsterLava._current == null)
                    {
                        Pax4ActorEnemyMonsterLava monsterLava = new Pax4ActorEnemyMonsterLava(_lavaIndex.ToString(), null, _lavaIndex);
                        monsterLava.MoveTo(Vector3.Zero, wayPointPath._wayPoint[0]);
                        new Pax4WayPointControllerActor(monsterLava, _difficulty, wayPointPath);
                        monsterLava.Enable();
                        continue;
                    }
                }
                else
                {
                    switch (p_populateWithActorsType)
                    {
                    case EPopulateWithActorsType._HOMOGENEOUS:

                        if (wayPointPath._wayPoint.Length == 1)
                        {
                            if (p_lava)
                            {
                                actor = new Pax4ActorEnemyAmmoLava(_lavaIndex.ToString(), null, _lavaIndex);
                                actor.SetScale(Vector3.One * 1.8f);
                            }
                            else
                            {
                                actor = new Pax4ActorEnemyAmmoIce(_iceIndex.ToString(), null, _iceIndex);
                                actor.SetScale(Vector3.One * 1.8f);
                            }

                            if (wi % _powerUpRatio == 0)
                            {
                                actor.SetPowerUp(Pax4Actor.EActorPowerUp._DURABILITY);
                            }

                            actor.MoveTo(Vector3.Zero, wayPointPath._wayPoint[0]);

                            new Pax4WayPointControllerActor(actor, Pax4WorldLavaAndIce._difficulty * 3.0f * p_velocityFactor, wayPointPath, 0);
                            actor.Enable();
                            if (p_result != null)
                            {
                                p_result.Add(actor);
                            }
                        }
                        else
                        {
                            for (int i = 0; i < wayPointPath._wayPoint.Length; i++)
                            {
                                if (i % 3 != 0)
                                {
                                    continue;
                                }

                                if (p_lava)
                                {
                                    actor = new Pax4ActorEnemyAmmoLava(_lavaIndex.ToString(), null, _lavaIndex);
                                    actor.SetScale(Vector3.One * 1.8f);
                                }
                                else
                                {
                                    actor = new Pax4ActorEnemyAmmoIce(_iceIndex.ToString(), null, _iceIndex);
                                    actor.SetScale(Vector3.One * 1.8f);
                                }

                                actor.MoveTo(Vector3.Zero, wayPointPath._wayPoint[i]);

                                if (i % _powerUpRatio == 0)
                                {
                                    actor.SetPowerUp(Pax4Actor.EActorPowerUp._DURABILITY);
                                }

                                new Pax4WayPointControllerActor(actor, Pax4WorldLavaAndIce._difficulty * 3.0f * p_velocityFactor, wayPointPath, i);
                                actor.Enable();
                                if (p_result != null)
                                {
                                    p_result.Add(actor);
                                }
                            }
                        }

                        break;

                    case EPopulateWithActorsType._HETEROGENEOUS:

                        if (wayPointPath._wayPoint.Length == 1)
                        {
                            if (wi % 2 == 0)
                            {
                                actor = new Pax4ActorEnemyAmmoLava(_lavaIndex.ToString(), null, _lavaIndex);
                                actor.SetScale(Vector3.One * 1.8f);
                            }
                            else
                            {
                                actor = new Pax4ActorEnemyAmmoIce(_iceIndex.ToString(), null, _iceIndex);
                                actor.SetScale(Vector3.One * 1.8f);
                            }

                            if (wi % _powerUpRatio == 0)
                            {
                                actor.SetPowerUp(Pax4Actor.EActorPowerUp._DURABILITY);
                            }

                            actor.MoveTo(Vector3.Zero, wayPointPath._wayPoint[0]);

                            new Pax4WayPointControllerActor(actor, Pax4WorldLavaAndIce._difficulty * 3.0f * p_velocityFactor, wayPointPath, 0);
                            actor.Enable();
                            if (p_result != null)
                            {
                                p_result.Add(actor);
                            }
                        }
                        else
                        {
                            for (int i = 0; i < wayPointPath._wayPoint.Length; i++)
                            {
                                if (i % 3 != 0)
                                {
                                    continue;
                                }

                                if (i % 2 == 0)
                                {
                                    actor = new Pax4ActorEnemyAmmoLava(_lavaIndex.ToString(), null, _lavaIndex);
                                    actor.SetScale(Vector3.One * 1.8f);
                                }
                                else
                                {
                                    actor = new Pax4ActorEnemyAmmoIce(_iceIndex.ToString(), null, _iceIndex);
                                    actor.SetScale(Vector3.One * 1.8f);
                                }

                                actor.MoveTo(Vector3.Zero, wayPointPath._wayPoint[i]);

                                if (i % _powerUpRatio == 0)
                                {
                                    actor.SetPowerUp(Pax4Actor.EActorPowerUp._DURABILITY);
                                }

                                new Pax4WayPointControllerActor(actor, Pax4WorldLavaAndIce._difficulty * 3.0f * p_velocityFactor, wayPointPath, i);
                                actor.Enable();
                                if (p_result != null)
                                {
                                    p_result.Add(actor);
                                }
                            }
                        }

                        break;

                    case EPopulateWithActorsType._LAYERED:

                        if (wayPointPath._wayPoint.Length == 1)
                        {
                            if (wi < half)
                            {
                                if (p_lava)
                                {
                                    actor = new Pax4ActorEnemyAmmoLava(_lavaIndex.ToString(), null, _lavaIndex);
                                    actor.SetScale(Vector3.One * 1.8f);
                                }
                                else
                                {
                                    actor = new Pax4ActorEnemyAmmoIce(_iceIndex.ToString(), null, _iceIndex);
                                    actor.SetScale(Vector3.One * 1.8f);
                                }
                            }
                            else
                            {
                                if (p_lava)
                                {
                                    actor = new Pax4ActorEnemyAmmoLava(_lavaIndex.ToString(), null, _lavaIndex);
                                    actor.SetScale(Vector3.One * 1.8f);
                                }
                                else
                                {
                                    actor = new Pax4ActorEnemyAmmoIce(_iceIndex.ToString(), null, _iceIndex);
                                    actor.SetScale(Vector3.One * 1.8f);
                                }
                            }

                            if (wi % _powerUpRatio == 0)
                            {
                                actor.SetPowerUp(Pax4Actor.EActorPowerUp._DURABILITY);
                            }

                            actor.MoveTo(Vector3.Zero, wayPointPath._wayPoint[0]);

                            new Pax4WayPointControllerActor(actor, Pax4WorldLavaAndIce._difficulty * 3.0f * p_velocityFactor, wayPointPath, 0);
                            actor.Enable();
                            if (p_result != null)
                            {
                                p_result.Add(actor);
                            }
                        }
                        else
                        {
                            for (int i = 0; i < wayPointPath._wayPoint.Length; i++)
                            {
                                if (i % 3 != 0)
                                {
                                    continue;
                                }

                                if (i < halfLength)
                                {
                                    if (p_lava)
                                    {
                                        actor = new Pax4ActorEnemyAmmoLava(_lavaIndex.ToString(), null, _lavaIndex);
                                        actor.SetScale(Vector3.One * 1.8f);
                                    }
                                    else
                                    {
                                        actor = new Pax4ActorEnemyAmmoIce(_iceIndex.ToString(), null, _iceIndex);
                                        actor.SetScale(Vector3.One * 1.8f);
                                    }
                                }
                                else
                                {
                                    if (p_lava)
                                    {
                                        actor = new Pax4ActorEnemyAmmoLava(_lavaIndex.ToString(), null, _lavaIndex);
                                        actor.SetScale(Vector3.One * 1.8f);
                                    }
                                    else
                                    {
                                        actor = new Pax4ActorEnemyAmmoIce(_iceIndex.ToString(), null, _iceIndex);
                                        actor.SetScale(Vector3.One * 1.8f);
                                    }
                                }

                                actor.MoveTo(Vector3.Zero, wayPointPath._wayPoint[i]);

                                if (i % _powerUpRatio == 0)
                                {
                                    actor.SetPowerUp(Pax4Actor.EActorPowerUp._DURABILITY);
                                }

                                new Pax4WayPointControllerActor(actor, Pax4WorldLavaAndIce._difficulty * 3.0f * p_velocityFactor, wayPointPath, i);
                                actor.Enable();
                                if (p_result != null)
                                {
                                    p_result.Add(actor);
                                }
                            }
                        }

                        break;
                    }
                }
            }
        }
Exemple #2
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;
                }
            }
        }