public override BTNodeStates Eval() { Unit activeUnit = btManager.activeUnit; activeUnit.unitState = Unit.state.Moving; var cover = btManager.findCover(); activeUnit.TeleportPlayer(cover.goal, cover.energy); return(BTNodeStates.SUCCESS); }
public override BTNodeStates Eval() { Unit activeUnit = btManager.activeUnit; var cover = btManager.findCover(); int coverEnergy = cover.energy + activeUnit.weapon.energyRequired; while (activeUnit.currentEnergy > coverEnergy) { activeUnit.unitState = Unit.state.Attacking; btManager.AttackAction(); } activeUnit.unitState = Unit.state.Moving; activeUnit.TeleportPlayer(cover.goal, cover.energy); activeUnit.unitState = Unit.state.Idle; return(BTNodeStates.SUCCESS); }