Game Development Reference
In-Depth Information
float playbackTime =
currentState.length;
BroadcastMessage("Fire",playbackTime);
IsWaitForAiming = true;
}
}
} else {
if (IsShot) {
if
(currentState.IsName("Shooting.Shoot")) {
IsShot = false;
float playbackTime =
currentState.length;
StartCoroutine(WaitForShot(playbackTime));
}
}
}
}
} else {
IsShowLaser(false);
IsRun =
(waypointsContainer.AwayFromWaypoint(transform.position,
distanceToShot)) ? false : Run();
ApplyMoveDirection();
ApplyMoveSpeed();
ApplyJumping(Jump(MoveDirection));
}
} else {
IsShowLaser(false);
}
if (!IsAiming) {
UpdateMovement();
}
}
}
6. Now, we have finished our AI script. Go back to the Unity editor and drag the AI
script on
robotAI_C#
(for C# users) or
robotAI_JS
(for JS users). Then, we will