Skip to content

Commit

Permalink
Interrupt bot if hit when pushing snowball
Browse files Browse the repository at this point in the history
  • Loading branch information
tiare committed Jul 12, 2012
1 parent da26c92 commit ffb2135
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions SnowFight/Assets/Players/AI/BotAI.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function Update () {
// && !pStatus.IsRidingUfo() && Time.time > (stuckTime + timeoutWhenStuck)
// && motor.movement.velocity.magnitude < attackSpeed * 0.3) {
if (moveDir != Vector3.zero && Time.time > (stuckTime + timeoutWhenStuck)
&& motor.movement.velocity.magnitude < attackSpeed * 0.5) {
&& motor.movement.velocity.magnitude < attackSpeed * 0.3) {

if (!stuck) { //strafe, or change direction
stuck = true;
Expand Down Expand Up @@ -429,11 +429,20 @@ function RollBall ()

while (true) {
motor.inputAction = false;

if (!target || pStatus.IsRidingUfo()) {
groundBaseFlag = null;
RemoveTarget();
return;
}

var attack = pStatus.GetLastAttack();
if (!target || pStatus.IsRidingUfo() || (attack && (Time.time - attack.time)<0.01)) {
if(attack && (Time.time - attack.time)<0.01) {
targets = [];
groundBaseFlag = null;
RemoveTarget();
if (ball)
itemManager.ReleaseItem();
return;
}

Expand Down

0 comments on commit ffb2135

Please sign in to comment.