Day 27 of 100 Days of VR: Adding New Bandit Enemy

  1. A lower health, but faster unit
  2. A higher health, but slower unit

Step 1: Acquire new assets

Step 1.1: Get bandit asset

Step 2: Setup BasicBandit

Step 2.0: Set Wave 1 SpawnManager to Spawn -1 Enemies

Step 2.1: Attach the Knight Animatior Controller

  1. In Assets > BasicBandit, drag and drop Basic_BanditPrefab into our game.
  2. Select our bandit in the hierarchy and in the Animator component, under Controller, select our Knight Animator Controller to fill in the slot.

Step 2.2: Add the Nav Mesh Agent and the 3 scripts: EnemyHealth, EnemyAttack, and EnemyMovement

  • Nav Mesh Agent component to be the navigation AI to make the bandit chase after the player
  • EnemyHealth: to receive the damage when the player shoots the enemy
  • EnemyAttack: to detect when the enemy injures the player
  • EnemyMovement: to control the movement logic for the enemy

Step 2.3: Setting up the Scripts and Nav Mesh Agent

Nav Mesh Agent

EnemyHealth

  • Health: 5
  • Hit Sfx Clips > Size: 4
  • Set the 4 new Audio Clips to be Male_Hurt_01Male_Hurt_04
  • Hit Sound Delta: 5

EnemyMovement

  • Walking Clips > Size: 4
  • Set the 4 new Audio Clips to be Footstep01 — Footstep04
  • Walking Delay:3

EnemyAttack

  • Attack Sfx Clips > Size: 3
  • Set the 3 new Audio Clips to be Punch_01 — Punch_03
  • Leave the Fist Colliders alone for now

Step 2.4: Adding 3 Colliders: Trigger Collider, Mesh Collider, and Fist Colliders

  • A Capsule Collider to be used as a trigger to tell our bandit to enter attack mode if he’s near the player.
  • 2 Box Collider that will be attached to the bandit’s hand to tell when we damage the player.
  • A Mesh Collider to be used for detecting when the player shoots the bandit.

Adding the Capsule Collider

Adding the 2 Box Colliders

Adding the Mesh Collider

  1. We can shoot the enemy
  2. The enemy can push us around

Step 2.4: Set Bandit’s Layer to be Shootable

Step 2.4: Attach our Fist Colliders to EnemyAttack

  • Left Fist: L
  • Right Fist: R

Step 2.5: Create a prefab of our Bandit

Conclusion

--

--

--

Software Engineer by day, side hustler wannabee by night! https://leetdev.io

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Legends Pokémon Arceus: The 11 rarest creatures of getting in the HISUI region

How to perform the task “Hidden Mission” in LEGO STAR WARS SKYWALKER SAGA

Google Stadia Expands

Bedrock Big Onion's Seasonal Decorations (Holiday themed Blocks, Items, Mounts & More!)

Rest In Peace, Flash Games.

Ubisoft validates the advancement of its new PVP Battle Arena action video game after the current…

Into Game Mechanics: Trigger Cutscene all over the Scene

Destiny 2: Trailer explores the throne world of the witch king

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Josh Chang

Josh Chang

Software Engineer by day, side hustler wannabee by night! https://leetdev.io

More from Medium

Adding an Impulse UE5

Recommendations that work

OptraSCAN’s Artificial Intelligence-Equipped Digital Pathology Scanner OS-SiA Granted U.S

HOW TO IMPROVE YOUR VOCABULARY