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

UNITY | PROJECT | RPG Tutorial |9. Weapon Animation

2
Creating Animation for Sword
316.png
Creating Animation for Sword
4
Creating Animation for Sword
  • create an Animation
    • by changing Transform(Position & Rotation) however I want
    • for each frame we can add changes
4-1
Creating Animation for Sword

 

5
“Animation” Component
  • Remove Animator(New)
  • Add Animation(Legacy)
    • Put the Animation for Sword in Animation Component as Animation & Element0
    • Since we have one animation, Set Size into 1
6
“Animation” | Legacy
  • in Animation Component,
    • in Debug tap, check Legacy
7
Animation | Wrap Mode | Once
  • to make Animation play once, change Wrap Mode into Once
8
InputManager | Key “Fire1” for Left Mouse Button
9
“SwingSword” Script
  • create Variables
    • for Sword we are yielding
    • for the status of sword
10-1
Animation Working
10
Adding Script to Sword
11
“AttackBlocker” Script
  • create a script to prevent Player from Yielding Sword in specific conditions
  • create variables one static and the other as path
  • in Update() method
    • put the static variable in the path variable
12
Adding “AttackBlocker” into “GlobalStat”
13
“Quest001” Script
  • add AttackBlocker.blockSword to Quest001 to change the status of swinging Sword
    • in OnMouseExit() method,
      • set the status as 0, indicating Swinging is available
    • in OnMouseOver() method,
      • when Action Button is pressed,
        • set the status as 2(actually 1), indicating Swinging is not available when grabbing the Notice
      • when Distance is less than 3,
        • set the status as 2(actually 1), indicating Swinging is not available when standing in front of the Notice Board
14
“SwingSword” Script
  • Add AttackBlocker.blockSword ==0 to the condition of if statement
14-1
Swinging Sword is not working