Hello,
In my game I currently have a playing field with obstacles, a playable Player that can melee(Raycast) and shoot(collision-based) and an Enemy AI with Astar AI system that can detect obstacles and does pathfinding on its own, the AI also wanders around the scene at random direction and then follows the player when spotted.
Both the Player and Enemy are just Capsules. I used a program called Makehuman which allows you to create realistic human bodies and export it to Unity with a rig already attached, so I can now start animating straight away.
I know how to animate and script Humans (eg. Walk/Run animation when pressing W, A, S or D, etc). But Enemy AI that does not press buttons? I don’t know…
Is there any good tutorial series that will help me exactly how to implement animations into players/AI? I’d prefer a video series since when I read documentation for Blender and Unity I just fell asleep, I am not really into programming but this is for my software school project which tells us to make a game.
Also as a bonus question. I currently applied footstep audio and shooting audio to my Player whenever the Player presses Input buttons that they could horizontally or vertically move then the footstep audio will automatically play and loops or whenever the presses the Left Mouse button (Fire1) the shoot audio also plays. But how do you apply that to Enemy which does not have an Input? How do I say: if Enemy moves Horizontal or Vertical → Play Audio or if Enemy shoot/melee → Play Audio?
Here is my Javascript for the Player Audio which works absolutely fine:
var footsteps : AudioClip;
function Start()
{
audio.clip = footsteps;
audio.loop = true;
}
function Update()
{
// If a movement button has been pressed, play sound
if (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0)
{
// Only start playing, if the audio hasn't been started yet
if(!audio.isPlaying)
audio.Play();
}
// If none of the movement buttons is pressed, stop sound
if(Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0){
audio.Stop();
How do I translate that to Enemy AI?
I am a beginner when it comes to programming, but as a game modder I do understand Javascripts/CS but writing from scratch? Not so sure.
Thank you.