public bool selectMove(ShiblitzMove move) { if (Game.getState() == Game.State.GETTING_PLAYER_INPUT && Game.getPlayer().mana >= move.manaCost) { clearInputChoices(); selectedMove = move; showInput(); return(true); } return(false); }
public void clearInputChoices() { selectedMove = null; if (inputChoices == null) { return; } foreach (Vector2Int v in inputChoices) { Game.getDungeonBoard().gui.SetTile((Vector3Int)v, null); } inputChoices = null; }
public virtual void queueMove() { ShiblitzMove move = moves[UnityEngine.Random.Range(0, moves.Count)]; List <Vector2Int> possibleMoves = move.getCastableLocations(position); if (possibleMoves.Count > 0) { Vector2Int moveLocation = possibleMoves[0]; foreach (Vector2Int v in possibleMoves) { if (Vector2Int.Distance(v, Game.getPlayer().position) < Vector2Int.Distance(moveLocation, Game.getPlayer().position)) { moveLocation = v; } } Game.getDungeonBoard().gui.SetTile((Vector3Int)moveLocation, ShiblitzTile.enemyInputHighlight); move.setCastLocation(moveLocation); Game.QueueMove(move); } }
public static void QueueMove(ShiblitzMove m) { instance.queuedMoves.Add(m); }
public void update() { switch (state) { case State.ROUND_START: Game.getSpellManager().tick(); Game.getEnemyHandler().tick(); Spell s = Game.getSpellManager().getSpell(Game.getPlayer().position); if (s != null) { Game.getPlayer().takeDamage(s.damage); } Game.getDungeonBoard().occupiedSpaces = new List <Vector2Int>(); timeInFixedFrames = 0; //inputManager.selectMove(new GodMove(Game.getPlayer())); foreach (Enemy e in enemyHandler.getAggroedEnemies()) { e.queueMove(); } finishState(State.ROUND_START); break; case State.GETTING_PLAYER_INPUT: inputTimer.value = ((300.0f - timeInFixedFrames) / 300); if (timeInFixedFrames > 300) { finishState(State.GETTING_PLAYER_INPUT); } // InputHandler can get input from the user while this state is active break; case State.PERFORMING_ACTIONS: if (queuedMoves.Count == 0) { moveQueuePointer = 0; queuedMoves = new List <ShiblitzMove>(); finishState(State.PERFORMING_ACTIONS); break; } ShiblitzMove move = queuedMoves[moveQueuePointer]; if (!move.started()) { move.performMove(); } if (Game.getEnemyHandler().getAggroedEnemies().Count == 0) { moveQueuePointer = 0; queuedMoves = new List <ShiblitzMove>(); finishState(State.PERFORMING_ACTIONS); break; } if (move.isFinished()) { moveQueuePointer++; } if (moveQueuePointer >= queuedMoves.Count) { moveQueuePointer = 0; queuedMoves = new List <ShiblitzMove>(); finishState(State.PERFORMING_ACTIONS); } break; default: Debug.Log("Game state is not listed in State enum"); break; } inputManager.update(); }