public ActionResult DeleteConfirmed(int id) { Skript skript = db.Skripte.Find(id); db.Skripte.Remove(skript); db.SaveChanges(); return(RedirectToAction("Index")); }
// get set public override void runTurn() { // checks first if key available. if not continue loop if (Console.KeyAvailable) { ConsoleKey letter = Console.ReadKey(true).Key; Skript.processKey(letter); proKey(letter); } }
// spawn minions here public void passMinute() { Skript.spawnMinions(); minute++; if (minute == MINtoHOUR) { minute = 0; passHour(); } }
public ActionResult Edit([Bind(Include = "ID,Name,Displayname,Discription,Status")] Skript skript) { if (ModelState.IsValid) { db.Entry(skript).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(skript)); }
public virtual void spawnUnit(Unit u) { if (u != null) { u.constrUnit(Skript.getBattle(), getCurrentLane()); } else { Printer.justPrint(Printer.attackLog, "Error: Unit = null"); } }
public ActionResult Create([Bind(Include = "ID,Name,Displayname,Discription,Status")] Skript skript) { if (ModelState.IsValid) { db.Skripte.Add(skript); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(skript)); }
// public override void spawnUnit(Unit un) { // if(un != null) { // un.constrUnit(Skript.getBattle(), getCurrentLane()); // } else { // Printer.justPrint("Error: Unit = null"); // } // } public bool spawnEnemy(Unit u) { ((Botplayer)Skript.getBattle().getPlayer(false)).receiveOrder(u); if (u != null) { return(true); } else { return(false); } }
// GET: Skripts/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Skript skript = db.Skripte.Find(id); if (skript == null) { return(HttpNotFound()); } return(View(skript)); }
// runs in Main until KeyAvailable and ReadKey.Key == Escape public void run() { bool check = true; while (check) { // stop battle if (!Skript.getContinueGame()) { endGame(); break; } //ask for players turn player_1.runTurn(); player_2.runTurn(); // execute turn each loop turn(); } }
static void Main(string[] args) { Console.WriteLine("Hello World!"); // max height, width. (72,240) Terminal.setSize(40, 200); Skript.greet(); // tost(); // battle constructor // (int turnDuration, int mapSize, nexus_pos_x, nexus_pos_y) Battle battle = new Battle(100, 120, 122, 10, 30); Skript.printBounds(battle.getMap(0)); Skript.printBounds(battle.getMap(1)); Skript.printBounds(battle.getMap(2)); // console dimensions // test(battle, 5, true); // test(battle, 5, false); // run(int armySizeForEachPlayer) battle.run(); Console.CursorVisible = true; Console.ReadKey(); }
void proKey(ConsoleKey key) { if (Skript.processKey(key)) { return; } // test // spawn enemy units Unit eUnit = null; if (key.ToString() == "U") { eUnit = new Warrior(false); } if (key.ToString() == "I") { eUnit = new Archer(false); } if (key.ToString() == "O") { eUnit = new Lancer(false); } // skip spawnUnit to avoid printing "Unit = null" // only if enemy got to spawn an Unit if (spawnEnemy(eUnit)) { return; } // player key // check for lane change switch (key.ToString()) { case "D1": changeCurrentLane(0); break; case "D2": changeCurrentLane(1); break; case "D3": changeCurrentLane(2); break; } Unit u = null; switch (key.ToString()) { case "w": case "W": u = new Warrior(true); break; case "a": case "A": u = new Archer(true); break; case "Z": u = new Lancer(true); break; } spawnUnit(u); }
// constructor helpers void setUp() { Skript.setBattle(this); player_1 = new Player(); player_2 = new Botplayer(); }