protected override void CreateLevel() { MusicPlay("sounds/level1Loop"); levelSize = new Vector2(100, 75); //set the level size CreateObject("SpaceDustPF", gameBounds.center, 0); for (int i = 0; i < 2; i++) { RedBlob current = (RedBlob)CreateObject("RedBlobPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { GreenBlob current = (GreenBlob)CreateObject("GreenBlobPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { BlueBlob current = (BlueBlob)CreateObject("BlueBlobPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } Accelerant accelerant = (Accelerant)CreateObject("AccelerantFP"); }
private IEnumerable <Wait> RoutineSpawn(Creature creature) { SceneGame world = creature.World; Tile tile = creature.Tile; double slimeDamage = 100; double slimeHP = Math.Min(slimeDamage, creature.CurrentHP); creature.TakeStatDamage(slimeDamage, Stat.HP); if (slimeHP > 0) { var slime = new GreenBlob(world, slimeHP); slime.MoveTo(tile, 0); //slime.MakeAggressive(world.Player); slime.AddControlTurn(); var neighbors = tile.GetAdjacentNeighbors().Shuffle(Random); var pick = neighbors.Where(x => !x.Solid && x.Creatures.Empty()).FirstOrDefault(); if (pick == null) { pick = neighbors.FirstOrDefault(); } slime.MoveTo(pick, 20); yield return(slime.WaitSome(20)); if (pick.Solid || pick.Creatures.Any(x => x != slime)) { new GreenBlobPop(slime.World, slime.VisualTarget, Vector2.Zero, 0, 10); slime.Destroy(); } } }
public AbstractBlob GetBlob(string name) { BlobFactory blobFactory = new BlobFactory(); if (name.ToLower().Equals("blue")) { return(blobFactory.MakeBlueBlob()); } else if (name.ToLower().Equals("red")) { return(blobFactory.MakeRedBlob()); } else if (name.ToLower().Equals("green")) { GreenBlob blob = (GreenBlob)blobFactory.MakeGreenBlob(); AcquaintanceAura aura = GameObject.FindGameObjectWithTag("Aura").GetComponent <AcquaintanceAura>();//to be removed blob.AddAuraScript(aura); return(blob); } return(null); }
private const int WAVE_TIME_SECS = 60; //60 seconds between waves protected override void UpdateLevel() { waveTimer--; //determine if there are any enemies left in the level bool noEnemies = true; foreach (DestructableObject item in destructables) { if (item.team <= 0) { noEnemies = false; break; } } //if it is time for the next wave or there are not more enemies, go to the next wave if (waveTimer <= 0 || noEnemies) { //reset waveTimer waveTimer = (int)(WAVE_TIME_SECS * updatesPerSec); //update wave numbers type++; if (type > NUM_TYPES) { type = 1; round++; } //find which type of enemies to spawn, then spawn a number equal to the round //bascially, each type is gone through one at a time then it is started at the //begining again but this time, waves make one more of that type than last time //each type also gives the user a different item, each round the item given gets stronger //a message is dispayed to the user when each wave is spawned, telling them abou the wave switch (type) { case 1: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Suttering Debris and a " + round + " power Heal item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { SputteringDebris current = (SputteringDebris)CreateObject("SputteringDebrisPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } Heal heal = (Heal)CreateObject("HealPF"); heal.healthPerSecGain *= round * ITEM_POWER_INCRIMENT; break; case 2: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Aseroid(s) and a " + round + " power MultiShot item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { Asteroid current = (Asteroid)CreateObject("AsteroidPF", GetRandomGameEdge(), GetRandomAngle(), 0, random.Next(100)); current.velocity = GetRandomVelocity((int)current.maxSpeed); } MultiShots multiShot = (MultiShots)CreateObject("MultiShotPF"); multiShot.numberOfShots *= round * ITEM_POWER_INCRIMENT; break; case 3: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Lazer Emitters(s) and a " + round + " power Lazer Sword item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { LazerEmitter current = (LazerEmitter)CreateObject("LazerEmitterPF", GetRandomGameEdge(), GetRandomAngle(), 0, random.Next(100)); current.velocity = GetRandomVelocity((int)current.maxSpeed); } LazerSword sword = (LazerSword)CreateObject("LazerSwordPF"); sword.swordLength *= round * ITEM_POWER_INCRIMENT; break; case 4: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Random Turner(s) and a " + round + " power Homing Missiles item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { RandomTurner current = (RandomTurner)CreateObject("RandomTurnerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } HomingMissiles homing = (HomingMissiles)CreateObject("HomingMissilesPF"); homing.missileDamge *= round * ITEM_POWER_INCRIMENT; break; case 5: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Mine Layer(s) and a " + round + " power Gravity Well Controller item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } GravityWellController well = (GravityWellController)CreateObject("GravityWellControllerPF"); well.maxGravity *= round * ITEM_POWER_INCRIMENT; break; case 6: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Rotating Lazer Sentry(s) and a " + round + " power Lazer Beam item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { RotatingLazerSentry current = (RotatingLazerSentry)CreateObject("RotatingLazerSentryPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } LazerBeam beam = (LazerBeam)CreateObject("LazerBeamPF"); beam.beamDamge = (beam.beamDamge - 1) * round * ITEM_POWER_INCRIMENT + 1; break; case 7: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Green Blob(s) and a " + round + " power Rapid Shots item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { GreenBlob current = (GreenBlob)CreateObject("GreenBlobPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } RapidShots rapid = (RapidShots)CreateObject("RapidShotsPF"); rapid.shotDamage *= round * ITEM_POWER_INCRIMENT; break; case 8: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Red Blob(s) and a " + round + " power Armor item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { RedBlob current = (RedBlob)CreateObject("RedBlobPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } Armor armor = (Armor)CreateObject("ArmorPF"); armor.armorGain *= round * ITEM_POWER_INCRIMENT; break; case 9: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Blue Blob(s) and a " + round + " power Charged Shot item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { BlueBlob current = (BlueBlob)CreateObject("BlueBlobPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } ChargedShots charged = (ChargedShots)CreateObject("ChargedShotPF"); charged.shotMaxDamage *= round * ITEM_POWER_INCRIMENT; break; case 10: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Slow Turner(s) and a " + round + " power Homing Mines item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { SlowTurner current = (SlowTurner)CreateObject("SlowTurnerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } HomingMines mines = (HomingMines)CreateObject("HomingMinesPF"); mines.maxMines = (int)(round * ITEM_POWER_INCRIMENT * mines.maxMines); mines.layTimeSecs *= round * ITEM_POWER_INCRIMENT; break; case 11: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " Rammer(s) and a " + round + " power Accelerant item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { Rammer current = (Rammer)CreateObject("RammerPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } Accelerant accelerant = (Accelerant)CreateObject("AccelerantFP"); accelerant.accelerationPerSecGain *= round * ITEM_POWER_INCRIMENT; break; case 12: IngameInterface.DisplayMessage("Wave " + (type * (round - 1) + type) + ", " + round + " LazerShooter(s) and a " + round + " power Shield item.", WAVE_MESSAGE_TIME); for (int i = 0; i < round; i++) { LazerShooter current = (LazerShooter)CreateObject("LazerShooterPF", GetRandomGameEdge(), GetRandomAngle()); current.velocity = GetRandomVelocity((int)current.maxSpeed); } Shield shield = (Shield)CreateObject("ShieldPF"); shield.shieldWidth *= round * ITEM_POWER_INCRIMENT / 2.0f; break; default: if (type > 12) { round++; } type = 0; waveTimer = 0; Debug.Log("Veraible 'type' has an invalid value of: " + type); break; } } }
protected override void CreateLevel() { MusicPlay("sounds/level1Loop"); levelSize = new Vector2(80, 60); //set the level size CreateObject("SpaceDustPF", gameBounds.center, 0); for (int i = 0; i < 8; i++) { HomingMine current = (HomingMine)CreateObject("HomingMinePF", GetRandomPosition(), GetRandomAngle()); } for (int i = 0; i < 2; i++) { SlowTurner current = (SlowTurner)CreateObject("SlowTurnerPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { LazerShooter current = (LazerShooter)CreateObject("LazerShooterPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { MineLayer current = (MineLayer)CreateObject("MineLayerPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RotatingLazerSentry current = (RotatingLazerSentry)CreateObject("RotatingLazerSentryPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 2; i++) { LazerEmitter current = (LazerEmitter)CreateObject("LazerEmitterPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 4; i++) { IndestructableDebris current = (IndestructableDebris)CreateObject("IndestructableDebrisPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { RedBlob current = (RedBlob)CreateObject("RedBlobPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { GreenBlob current = (GreenBlob)CreateObject("GreenBlobPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } for (int i = 0; i < 1; i++) { BlueBlob current = (BlueBlob)CreateObject("BlueBlobPF", GetRandomPosition(), GetRandomAngle()); current.velocity = GetRandomVelocity(current.maxSpeed); } Armor armor = (Armor)CreateObject("ArmorPF"); }