public void asociateElements(Canon canion, MineralMine mina, SCV initial, Shield escudo) { asociatedCanon = canion; asociatedMine = mina; SCVBase = initial; ShieldBase = escudo; }
void Canon_canonDeath(Canon obj) { temporizador.stopTimer(); string msg = ""; if (MainCanon.currentHp <= 0) { msg = "¡juego finalizado! El ganador fue el jugador 2"; while (goodForcesElements.Count != 0) { goodForcesElements[0].hiting(999999999); } } if (!multiplay) { msg = "¡has perdido! Tu puntaje fue de " + points.ToString() + " suerte que no se te pegó el juego"; while (activeNaves.Count != 0) { activeNaves[0].hiting(100); } } else { if (SecondCanon.currentHp <= 0) { msg = "¡juego finalizado! El ganador ha sido el jugador 1"; while (secondGoodForcesElements.Count != 0) { secondGoodForcesElements[0].hiting(9999999999); } } } onSendError(msg); onLooseGame(msg); }
void Canon__death(BaseElement obj) { try { Canon sender = (Canon)obj; if (sender == SecondCanon) { secondGoodForcesElements.Remove(sender); } else { goodForcesElements.Remove(obj); } //onSendError("muerto cañón: #" + sender.netIdentifier); } catch (Exception e) { onSendError(e.Message); } }
public GameCore(int playLife, int initialMineral, int maxMineral) { MainCanon = new Canon(3, 2, @"CanonSounds\death.wav", playLife, new Point(0, 23), "cañón p1", @"CanonSounds\change.wav", colores.blue, @"CanonSounds\clip.wav"); MainCanon.setId(netIdentifierCounter); //onSendError("Cañón creado: #" + netIdentifierCounter); netIdentifierCounter++; MainCanon.addWeapon(new Weapon(1, 2, 2, "Lácer", @"CanonSounds\atk1.wav", @"CanonSounds\hit1.wav", @"CanonSounds\charge.wav", 10, false)); MainCanon.addWeapon(new Weapon(2, 3, 10, "Rocket", @"CanonSounds\atk2.wav", @"CanonSounds\hit2.wav", @"CanonSounds\charge.wav", 12, false)); MainCanon.addWeapon(new Weapon(3, 6, 6, "PlasmaPot", @"CanonSounds\atk3.wav", @"CanonSounds\hit3.wav", @"CanonSounds\charge.wav", 14, false)); MainCanon.addWeapon(new NuclearMisil(100, 27, 27, "NuclearMisil", @"CanonSounds\nukel.wav", @"CanonSounds\nukex.wav", @"CanonSounds\nuke1.wav", 3, @"CanonSounds\nuke2.wav", false)); SecondCanon = new Canon(3, 2, @"CanonSounds\death.wav", playLife, new Point(24, 3), "cañón p2", @"CanonSounds\change.wav", colores.red, @"CanonSounds\clip.wav"); SecondCanon.setId(netIdentifierCounter); //onSendError("Cañón creado: #" + netIdentifierCounter); netIdentifierCounter++; SecondCanon.addWeapon(new Weapon(1, 2, 2, "Lácer", @"CanonSounds\atk1.wav", @"CanonSounds\hit1.wav", @"CanonSounds\charge.wav", 10, true)); SecondCanon.addWeapon(new Weapon(2, 3, 10, "Rocket", @"CanonSounds\atk2.wav", @"CanonSounds\hit2.wav", @"CanonSounds\charge.wav", 12, true)); SecondCanon.addWeapon(new Weapon(3, 6, 6, "PlasmaPot", @"CanonSounds\atk3.wav", @"CanonSounds\hit3.wav", @"CanonSounds\charge.wav", 14, true)); SecondCanon.addWeapon(new NuclearMisil(100, 27, 27, "NuclearMisil", @"CanonSounds\nukel.wav", @"CanonSounds\nukex.wav", @"CanonSounds\nuke1.wav", 3, @"CanonSounds\nuke2.wav", true)); MainCanon.weapons[0].charge(100); MainCanon.weapons[1].charge(80); MainCanon.weapons[2].charge(50); SecondCanon.weapons[0].charge(100); SecondCanon.weapons[1].charge(80); SecondCanon.weapons[2].charge(50); bgmSound = new List <string>(); bgmSound.Add("BGM\\Wins.mp3"); bgmSound.Add("BGM\\fire.mp3"); bgmSound.Add("BGM\\Sand.mp3"); bgmSound.Add("BGM\\Bane.mp3"); bgmSound.Add("BGM\\Wolf.mp3"); bgmSound.Add("BGM\\ML.mp3"); bgmSound.Add("BGM\\Loose.mp3"); aleatorio = new Random(); MainMineralMine = new MineralMine("Minerales", new Point(0, 25), 3, 1, maxMineral, colores.gold, @"FabricsSounds\MineralDefeat.mp3"); MainMineralMine.setId(netIdentifierCounter); //onSendError("Mineral creado: #" + netIdentifierCounter); netIdentifierCounter++; secondMineralMine = new MineralMine("Minerales", new Point(26, 0), 3, 1, maxMineral, colores.gold, @"FabricsSounds\MineralDefeat.mp3"); secondMineralMine.setId(netIdentifierCounter); //onSendError("Mineral creado: #" + netIdentifierCounter); netIdentifierCounter++; activeBullets = new List <Bullet>(); MainFabrics = new Fabrics("Barraca", @"FabricsSounds\death.wav", @"FabricsSounds\select.wav", 3, 3, colores.silver, @"FabricsSounds\upgrade.wav", @"FabricsSounds\mineral.wav", @"FabricsSounds\pilon.wav", @"FabricsSounds\heal.wav", new Point(25, 25), (playLife + 200), initialMineral); MainFabrics.setId(netIdentifierCounter); //onSendError("Fábrica creada: #" + netIdentifierCounter); netIdentifierCounter++; secondFabrics = new Fabrics("Barraca", @"FabricsSounds\death.wav", @"FabricsSounds\select.wav", 3, 3, colores.silver, @"FabricsSounds\upgrade.wav", @"FabricsSounds\mineral.wav", @"FabricsSounds\pilon.wav", @"FabricsSounds\heal.wav", new Point(0, 0), (playLife + 200), initialMineral); secondFabrics.setId(netIdentifierCounter); //onSendError("Fabrica creada: #" + netIdentifierCounter); netIdentifierCounter++; MainScvBase = new SCV(5, @"ScvSounds\ready.wav", @"ScvSounds\death.wav", @"ScvSounds\mining.wav", colores.yellow, 6, 3, 5, new Point(MainFabrics.currentPosition.X, 26), 2, 2, "SCV", false); MainScvBase.asociatingMineAndFabrics(MainFabrics, MainMineralMine); secondScvBase = new SCV(5, @"ScvSounds\ready.wav", @"ScvSounds\death.wav", @"ScvSounds\mining.wav", colores.yellow, 6, 3, 5, new Point(secondFabrics.currentPosition.X + secondFabrics.width, 0), 2, 2, "SCV", true); secondScvBase.asociatingMineAndFabrics(secondFabrics, secondMineralMine); mainShieldBase = new Shield("Escudo", 1, 1, 1, @"ShieldSounds\ready.wav", @"ShieldSounds\Death.wav", @"ShieldSounds\fire.wav", @"ShieldSounds\hit.wav", 20, 3, 3, colores.cyan, 1, false, false, new Point(0, 0)); secondShieldBase = new Shield("Escudo", 1, 1, 1, @"ShieldSounds\ready.wav", @"ShieldSounds\Death.wav", @"ShieldSounds\fire.wav", @"ShieldSounds\hit.wav", 20, 3, 3, colores.cyan, 1, false, true, new Point(0, 0)); MainFabrics.asociateElements(MainCanon, MainMineralMine, MainScvBase, mainShieldBase); secondFabrics.asociateElements(SecondCanon, secondMineralMine, secondScvBase, secondShieldBase); goodForcesElements = new List <BaseElement>(); goodForcesElements.Add(MainCanon); goodForcesElements.Add(MainFabrics); secondGoodForcesElements = new List <BaseElement>(); secondGoodForcesElements.Add(SecondCanon); secondGoodForcesElements.Add(secondFabrics); temporizador = new GameTimer(new TimeSpan(0, 0, 1), 70, @"FabricsSounds\level.mp3"); GameTimer.ticActivated += new Action <GameTimer>(GameTimer_ticActivated); Fabrics.SCVCreated += new Action <SCV>(Fabrics_SCVCreated); temporizador.startTimer(); MainFabrics.createSCV(0, 0); secondFabrics.createSCV(0, 0); Weapon.shootNow += new Action <Bullet, Weapon>(Weapon_shootNow); Shield.reflector += new Action <Bullet, Shield>(Shield_reflector); Bullet.bulletDisapears += new Action <Bullet>(Bullet_bulletDisapears); NuclearMisil.nuclearImpact += new Action <NuclearMisil>(NuclearMisil_nuclearImpact); Fabrics._death += new Action <BaseElement>(Fabrics__death); SCV._death += new Action <BaseElement>(SCV__death); Canon._death += new Action <BaseElement>(Canon__death); Canon.canonDeath += new Action <Canon>(Canon_canonDeath); Shield._ready += new Action <BaseElement>(Shield__ready); Shield._death += new Action <BaseElement>(Shield__death); multiplay = true; }
public GameCore(bool fasterMode) { multiplay = false; MainCanon = new Canon(3, 2, @"CanonSounds\death.wav", 500, new Point(0, 23), "cañón", @"CanonSounds\change.wav", colores.blue, @"CanonSounds\clip.wav"); MainCanon.addWeapon(new Weapon(1, 2, 2, "Lácer", @"CanonSounds\atk1.wav", @"CanonSounds\hit1.wav", @"CanonSounds\charge.wav", 10, false)); MainCanon.addWeapon(new Weapon(2, 3, 10, "Rocket", @"CanonSounds\atk2.wav", @"CanonSounds\hit2.wav", @"CanonSounds\charge.wav", 12, false)); MainCanon.addWeapon(new Weapon(3, 6, 6, "PlasmaPot", @"CanonSounds\atk3.wav", @"CanonSounds\hit3.wav", @"CanonSounds\charge.wav", 14, false)); MainCanon.addWeapon(new NuclearMisil(100, 27, 27, "NuclearMisil", @"CanonSounds\nukel.wav", @"CanonSounds\nukex.wav", @"CanonSounds\nuke1.wav", 3, @"CanonSounds\nuke2.wav", false)); MainBaseNave = new List <Nave>(); if (fasterMode == false) { temporizador = new GameTimer(new TimeSpan(0, 0, 1), 70, @"FabricsSounds\level.mp3"); MainCanon.weapons[0].charge(100); MainCanon.weapons[1].charge(80); MainCanon.weapons[2].charge(50); MainBaseNave.Add(new Nave("interceptor", 1, 2, 2, @"SheepsSounds\1\ready.wav", @"SheepsSounds\1\death.wav", @"SheepsSounds\1\fire.wav", @"SheepsSounds\1\hit.wav", 1, 5, 0.025, 5, 0.5, 1, 1, colores.red)); MainBaseNave.Add(new Nave("Mutalisc", 2, 3, 2, @"SheepsSounds\2\ready.wav", @"SheepsSounds\2\death.wav", @"SheepsSounds\2\fire.wav", @"SheepsSounds\2\hit.wav", 3, 8, 0.1, 10, -1, 2, 3, colores.brown)); MainBaseNave.Add(new Nave("wright", 3, 2, 1, @"SheepsSounds\3\ready.wav", @"SheepsSounds\3\death.wav", @"SheepsSounds\3\fire.wav", @"SheepsSounds\3\hit.wav", 9, 5, 0.15, 20, -1, 2, 10, colores.darkRed)); MainBaseNave.Add(new Nave("RyuSheep", 4, 2, 2, @"SheepsSounds\4\ready.wav", @"SheepsSounds\4\death.wav", @"SheepsSounds\4\fire.wav", @"SheepsSounds\4\hit.wav", 3, 13, 0.2, 10, -1, 5, 1, colores.red)); MainBaseNave.Add(new Nave("Dragoon", 5, 5, 5, @"SheepsSounds\5\ready.wav", @"SheepsSounds\5\death.wav", @"SheepsSounds\5\fire.wav", @"SheepsSounds\5\hit.wav", 2, 15, 0.25, 3, -1, 20, 2, colores.fuxia)); MainBaseNave.Add(new Nave("FlyingLurker", 6, 4, 4, @"SheepsSounds\6\ready.wav", @"SheepsSounds\6\death.wav", @"SheepsSounds\6\fire.wav", @"SheepsSounds\6\hit.wav", 1, 25, 0.3, 15, -1, 3, 10, colores.gray)); MainBaseNave.Add(new Nave("Pajarín", 7, 1, 1, @"SheepsSounds\7\ready.wav", @"SheepsSounds\7\death.wav", @"SheepsSounds\7\fire.wav", @"SheepsSounds\7\hit.wav", 15, 25, 0.35, 20, -1, 1, 1, colores.green)); MainBaseNave.Add(new Nave("BattleCruicer", 8, 10, 10, @"SheepsSounds\8\ready.wav", @"SheepsSounds\8\death.wav", @"SheepsSounds\8\fire.wav", @"SheepsSounds\8\hit.wav", 2, 30, 0.4, 25, -1, 20, 20, colores.darkGreen)); MainBaseNave.Add(new Nave("guardian", 9, 5, 5, @"SheepsSounds\9\ready.wav", @"SheepsSounds\9\death.wav", @"SheepsSounds\9\fire.wav", @"SheepsSounds\9\hit.wav", 1, 30, 0.45, 20, -1, 27, 1, colores.cyan)); MainBaseNave.Add(new Nave("Galactus", 10, 20, 10, @"SheepsSounds\10\ready.wav", @"SheepsSounds\10\death.wav", @"SheepsSounds\10\fire.wav", @"SheepsSounds\10\hit.wav", 1, 90, 0.5, 5, -1, 5, 6, colores.white)); } else { temporizador = new GameTimer(new TimeSpan(0, 0, 1), 15, @"FabricsSounds\level.mp3"); MainCanon.weapons[0].charge(300); MainCanon.weapons[1].charge(200); MainCanon.weapons[2].charge(100); MainCanon.weapons[3].charge(2); MainBaseNave.Add(new Nave("interceptor", 2, 2, 2, @"SheepsSounds\1\ready.wav", @"SheepsSounds\1\death.wav", @"SheepsSounds\1\fire.wav", @"SheepsSounds\1\hit.wav", 1, 5, 0.2, 5, 0.5, 1, 1, colores.red)); MainBaseNave.Add(new Nave("Mutalisc", 4, 3, 2, @"SheepsSounds\2\ready.wav", @"SheepsSounds\2\death.wav", @"SheepsSounds\2\fire.wav", @"SheepsSounds\2\hit.wav", 3, 8, 0.3, 10, -1, 2, 3, colores.brown)); MainBaseNave.Add(new Nave("wright", 6, 2, 1, @"SheepsSounds\3\ready.wav", @"SheepsSounds\3\death.wav", @"SheepsSounds\3\fire.wav", @"SheepsSounds\3\hit.wav", 9, 5, 0.35, 20, -1, 2, 10, colores.darkRed)); MainBaseNave.Add(new Nave("RyuSheep", 7, 2, 2, @"SheepsSounds\4\ready.wav", @"SheepsSounds\4\death.wav", @"SheepsSounds\4\fire.wav", @"SheepsSounds\4\hit.wav", 3, 13, 0.4, 10, -1, 5, 1, colores.red)); MainBaseNave.Add(new Nave("Dragoon", 12, 5, 5, @"SheepsSounds\5\ready.wav", @"SheepsSounds\5\death.wav", @"SheepsSounds\5\fire.wav", @"SheepsSounds\5\hit.wav", 2, 15, 0.6, 3, -1, 20, 2, colores.fuxia)); MainBaseNave.Add(new Nave("FlyingLurker", 9, 4, 4, @"SheepsSounds\6\ready.wav", @"SheepsSounds\6\death.wav", @"SheepsSounds\6\fire.wav", @"SheepsSounds\6\hit.wav", 1, 25, 0.7, 15, -1, 3, 10, colores.gray)); MainBaseNave.Add(new Nave("Pajarín", 7, 1, 1, @"SheepsSounds\7\ready.wav", @"SheepsSounds\7\death.wav", @"SheepsSounds\7\fire.wav", @"SheepsSounds\7\hit.wav", 15, 25, 0.75, 20, -1, 1, 1, colores.green)); MainBaseNave.Add(new Nave("BattleCruicer", 15, 10, 10, @"SheepsSounds\8\ready.wav", @"SheepsSounds\8\death.wav", @"SheepsSounds\8\fire.wav", @"SheepsSounds\8\hit.wav", 2, 30, 0.8, 25, -1, 20, 20, colores.darkGreen)); MainBaseNave.Add(new Nave("guardian", 15, 5, 5, @"SheepsSounds\9\ready.wav", @"SheepsSounds\9\death.wav", @"SheepsSounds\9\fire.wav", @"SheepsSounds\9\hit.wav", 1, 30, 0.85, 20, -1, 27, 1, colores.cyan)); MainBaseNave.Add(new Nave("Galactus", 20, 20, 10, @"SheepsSounds\10\ready.wav", @"SheepsSounds\10\death.wav", @"SheepsSounds\10\fire.wav", @"SheepsSounds\10\hit.wav", 1, 90, 0.9, 5, -1, 5, 6, colores.white)); } bgmSound = new List <string>(); bgmSound.Add("BGM\\Wins.mp3"); bgmSound.Add("BGM\\fire.mp3"); bgmSound.Add("BGM\\Sand.mp3"); bgmSound.Add("BGM\\Bane.mp3"); bgmSound.Add("BGM\\Wolf.mp3"); bgmSound.Add("BGM\\ML.mp3"); bgmSound.Add("BGM\\Loose.mp3"); points = 0; aleatorio = new Random(); currentLevel = 1; MainMineralMine = new MineralMine("Minerales", new Point(0, 25), 3, 1, 1000, colores.gold, @"FabricsSounds\MineralDefeat.mp3"); activeBullets = new List <Bullet>(); activeNaves = new List <Nave>(); colaNaves = new Queue <Nave>(); MainFabrics = new Fabrics("Barraca", @"FabricsSounds\death.wav", @"FabricsSounds\select.wav", 3, 3, colores.silver, @"FabricsSounds\upgrade.wav", @"FabricsSounds\mineral.wav", @"FabricsSounds\pilon.wav", @"FabricsSounds\heal.wav", new Point(25, 25), 700, 50); MainScvBase = new SCV(5, @"ScvSounds\ready.wav", @"ScvSounds\death.wav", @"ScvSounds\mining.wav", colores.yellow, 6, 3, 5, new Point(MainFabrics.currentPosition.X, 26), 2, 2, "SCV", false); MainScvBase.asociatingMineAndFabrics(MainFabrics, MainMineralMine); mainShieldBase = new Shield("Escudo", 1, 1, 1, @"ShieldSounds\ready.wav", @"ShieldSounds\Death.wav", @"ShieldSounds\fire.wav", @"ShieldSounds\hit.wav", 20, 3, 3, colores.cyan, 1, false, false, new Point(0, 0)); MainFabrics.asociateElements(MainCanon, MainMineralMine, MainScvBase, mainShieldBase); goodForcesElements = new List <BaseElement>(); goodForcesElements.Add(MainCanon); goodForcesElements.Add(MainFabrics); GameTimer.levelUp += new Action <GameTimer>(GameTimer_levelUp); GameTimer.ticActivated += new Action <GameTimer>(GameTimer_ticActivated); Fabrics.SCVCreated += new Action <SCV>(Fabrics_SCVCreated); temporizador.startTimer(); MainFabrics.createSCV(0, 0); Weapon.shootNow += new Action <Bullet, Weapon>(Weapon_shootNow); Shield.reflector += new Action <Bullet, Shield>(Shield_reflector); Nave.shootNou += new Action <Nave, Bullet>(Nave_shootNou); Bullet.bulletDisapears += new Action <Bullet>(Bullet_bulletDisapears); NuclearMisil.nuclearImpact += new Action <NuclearMisil>(NuclearMisil_nuclearImpact); Fabrics._death += new Action <BaseElement>(Fabrics__death); SCV._death += new Action <BaseElement>(SCV__death); Canon._death += new Action <BaseElement>(Canon__death); Canon.canonDeath += new Action <Canon>(Canon_canonDeath); Nave._death += new Action <BaseElement>(Nave__death); Nave._ready += new Action <BaseElement>(Nave__ready); Shield._ready += new Action <BaseElement>(Shield__ready); Shield._death += new Action <BaseElement>(Shield__death); }