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; } } } }
private bool HandleCollisionDetectionOther(Vector3 p_effectPosition, Pax4Actor p_other = null, float p_healthStep = _normalHealthStep) { bool result = true; if (p_other == Pax4ActorEnemyMonsterLava._current) { if (Pax4ActorEnemyMonsterLava._current._shieldDown) { ((Pax4Actor)p_other)._health -= p_healthStep; ((Pax4WorldLavaAndIce)Pax4World._current).AutoBalance(); ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScore500.Trigger(ref p_effectPosition); Pax4UiStateLavaAndIceMission._currentMissionState._scoreSpriteModifier.Ini(((Pax4WorldLavaAndIce)Pax4World._current)._score, ((Pax4WorldLavaAndIce)Pax4World._current)._score + 500, true, 1.0f); Pax4UiStateLavaAndIceMission._currentMissionState._scoreSpriteModifier.Trigger(); ((Pax4WorldLavaAndIce)Pax4World._current)._score += 500; } else { ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScoreShieldUp.Trigger(ref p_effectPosition); } } else if (p_other == Pax4ActorEnemyMonsterIce._current) { if (Pax4ActorEnemyMonsterIce._current._shieldDown) { ((Pax4Actor)p_other)._health -= p_healthStep; ((Pax4WorldLavaAndIce)Pax4World._current).AutoBalance(); ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScore500.Trigger(ref p_effectPosition); Pax4UiStateLavaAndIceMission._currentMissionState._scoreSpriteModifier.Ini(((Pax4WorldLavaAndIce)Pax4World._current)._score, ((Pax4WorldLavaAndIce)Pax4World._current)._score + 500, true, 1.0f); Pax4UiStateLavaAndIceMission._currentMissionState._scoreSpriteModifier.Trigger(); ((Pax4WorldLavaAndIce)Pax4World._current)._score += 500; } else { ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScoreShieldUp.Trigger(ref p_effectPosition); } } else { ((Pax4Actor)p_other)._health -= p_healthStep; ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScore100.Trigger(ref p_effectPosition); Pax4UiStateLavaAndIceMission._currentMissionState._scoreSpriteModifier.Ini(((Pax4WorldLavaAndIce)Pax4World._current)._score, ((Pax4WorldLavaAndIce)Pax4World._current)._score + 100, true, 1.0f); Pax4UiStateLavaAndIceMission._currentMissionState._scoreSpriteModifier.Trigger(); ((Pax4WorldLavaAndIce)Pax4World._current)._score += 100; } if (p_other._actorClassType != EActorType._MONSTER && p_other._actorElementType == ((Pax4WorldLavaAndIce)Pax4World._current)._elementType1) { ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScoreGreat.Trigger(ref p_effectPosition); ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScore300.Trigger(ref p_effectPosition); int score = 300; ((Pax4WorldLavaAndIce)Pax4World._current)._score += score; if (p_other._actorElementType == ((Pax4WorldLavaAndIce)Pax4World._current)._elementType0) { ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScorePerfect.Trigger(ref p_effectPosition); ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScore500.Trigger(ref p_effectPosition); score += 500; ((Pax4WorldLavaAndIce)Pax4World._current)._score += 500; } Pax4UiStateLavaAndIceMission._currentMissionState._scoreSpriteModifier.Ini(((Pax4WorldLavaAndIce)Pax4World._current)._score, ((Pax4WorldLavaAndIce)Pax4World._current)._score + score, true, 1.0f); Pax4UiStateLavaAndIceMission._currentMissionState._scoreSpriteModifier.Trigger(); } if (((Pax4Actor)p_other)._health <= 0.0f) { if (p_other._actorClassType == EActorType._MONSTER) { ((Pax4WorldLavaAndIce)Pax4World._current)._monsterKills++; } else if (p_other._actorClassType == EActorType._AMMO && p_other._actorElementType == EActorType._LAVA) { ((Pax4WorldLavaAndIce)Pax4World._current)._lavaKills++; } else if (p_other._actorClassType == EActorType._AMMO && p_other._actorElementType == EActorType._ICE) { ((Pax4WorldLavaAndIce)Pax4World._current)._iceKills++; } ((Pax4Actor)p_other).RequestDx(); result = false; ((Pax4WorldLavaAndIce)Pax4World._current)._elementType0 = ((Pax4WorldLavaAndIce)Pax4World._current)._elementType1; ((Pax4WorldLavaAndIce)Pax4World._current)._elementType1 = p_other._actorElementType; if (this._actorPowerUp == EActorPowerUp._NORMAL) { if (this == Pax4ActorPlayerAmmoLava._current) { Pax4ActorPlayerAmmoLava._powerUp = ((Pax4Actor)p_other)._actorPowerUp; } else if (this == Pax4ActorPlayerAmmoIce._current) { Pax4ActorPlayerAmmoIce._powerUp = ((Pax4Actor)p_other)._actorPowerUp; } } } return(result); }
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; } } }