Beispiel #1
0
 //Calculates if the enemy unit being clicked is next to the user unit.
 bool inRange(MegaController unit)
 {
     if ((this.posX - 1 == unit.posX && this.posY == unit.posY) ||
         (this.posX + 1 == unit.posX && this.posY == unit.posY) ||
         (this.posX == unit.posX && this.posY - 1 == unit.posY) ||
         (this.posX == unit.posX && this.posY + 1 == unit.posY))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #2
0
 /*
  * void OnGUI() {
  *      if(attackMenu) {
  *              Rect window = GUI.Window(0, new Rect(Screen.width - 320, Screen.height - 300, 300, 300), attackInfo, "Battle stats");
  *      }
  * }
  *
  * void attackInfo(int aID) {
  *      if(GUI.Button(new Rect(0, 20, 300, 150), "Yes")) {
  *              enemyUnit.remove();
  *              enemyUnit = null;
  *              attackMenu = false;
  *      }if(GUI.Button(new Rect(0, 170, 300, 150), "No")) {
  *              attackMenu = false;
  *      }
  * }
  *
  */public static void battle(MegaController enemy)
 {
     enemyUnit  = enemy;
     attackMenu = true;
 }