UNITY | PROJECT | RPG Tutorial |12. Death Animation & Obtaining EXP

2
Adding Animations
3
changing “Wrap Mode”
4
“SpiderEnemy” Script
  • add variables for
    • the health of Spider
    • spider itself
    • the status of spider
  • in Update() method,
    • add another if statement for setting Spider’s Status to 0
  • in IEnumerator DeathSpider(),
    • when spider is dead, it’s status is set to 6
    • when dying, the animation, “die” is played
5-0
adding Script
  • be careful that we need to put Spider into the script not the gameObject with Collider
5-1
“die” Animation Working
6
“GlobalEXP” Script
7
“SpiderEnemy” Script
  • add variables for
    • the minimum EXP we get when we kill the spider
    • EXP calculated depending on the level of Player
  • in IEnumerator DeathSpider()
    • add the variable for EXP

8

  • create variables for
    • current level as static variable to use it in other scripts
    • a variable as a path for the static variable
  • in Update() method,
    • put the static variable in the path variable
9
Adding Script
10
Obtaining EXP
11
Changing Player’s Level
12
Amount of EXP Changed