private void ExecuteMove(Cell c, BARBARIAN_MOVE_TYPE type) { switch (type) { case BARBARIAN_MOVE_TYPE.MOVE: cell.occupant = 0; cell = c; cell.occupant = 2; break; case BARBARIAN_MOVE_TYPE.ATTACK: //c.enemy.Damage(currentDamage); currentAgent = c.enemy; break; case BARBARIAN_MOVE_TYPE.SPELL_STOMP: //Agent[] enemies = map.Agents3x3(cell.x, cell.y); Agent[] enemies = Game.AllEnemies(); for (int i = 0; i < enemies.Length; i++) { enemies[i].PushBack(cell); } break; case BARBARIAN_MOVE_TYPE.INVALID: break; case BARBARIAN_MOVE_TYPE.FINISH: // TODO: Implement "Next Level" break; default: break; } }
public float NextTurn(int d, int turn) { Cell c; MOVELIST dir = (MOVELIST)d; BARBARIAN_MOVE_TYPE type = DecideMove(dir, out c); ExecuteMove(c, type); if (type == BARBARIAN_MOVE_TYPE.INVALID) { return(0.01f); } return(VisualTurn(type, c, turn)); }
public float VisualTurn(BARBARIAN_MOVE_TYPE type, Cell c, int turn) { // Handle animations, effects etc. // Lerp to new cell. float r = Game.BARBARIAN_TIMER; switch (type) { case BARBARIAN_MOVE_TYPE.MOVE: anim.PlayAnimation("Barbarian_Move"); StartCoroutine(Move(c.position, 0.5f)); StartCoroutine(MoveCamera(c.position + camOffset, 0.5f)); StartCoroutine(Rotate(Helper.QDIR(c.position - transform.position), 0.1f)); break; case BARBARIAN_MOVE_TYPE.ATTACK: anim.PlayAnimation("Barbarian_Attack1"); StartCoroutine(Rotate(Helper.QDIR(c.position - transform.position), 0.1f)); break; case BARBARIAN_MOVE_TYPE.SPELL_STOMP: anim.PlayAnimation("Barbarian_Stomp"); FX.Emit(transform.localPosition + (Game.HALF_Y * 0.01f), Quaternion.identity, FX.VFX.Stomp, 1); break; case BARBARIAN_MOVE_TYPE.FINISH: //Here goes jump down animations and map lerps break; default: r = 0.0f; break; } return(r); }