UNITY | Project | RPG Tutorial | 20. Death Of Boss & Open Gate

2
Adding Animation for Death
3-1
NavMesh | Walking Boundary Working

 

3-2
Boss Working
3
“SpiderBoss” Script
  • create variables for
    • enemy health as 20 for boss
    • spider boss itself
    • flag for spider’s status
    • EXP when we kill the boss
    • EXP calculated relatively to Player’s level
    • spider’s AI
    • spider’s status
    • NPCs
    • flag for spider’s attack
  • in Start() method,
    • get the components of SpiderAI and SpiderAttack
  • create a function, DetuctPoint(),
    • when enemy is attacked, enemy’s health is decreased by the damageAmount
  • in Update() method,
    • make the spider’s status as global
    • if enemy’s health is less than 0
      • start the coroutine, DeathSpider
  • create IEnumerator DeathSpider(),
    • when spider is dead, disable the AI Script
    • set the spider’s status as 6
    • calculate the EXP
    • play the animation for death
    • turn on or off the NPCs

511.png

  • decrease the health of Spider Boss into 5 to make debugging faster
  • when Spider Boss died, turn off the Spider’s attack script

 

5-1
Boss died
6
“OpenGate” Script
  • create variables
    • distance between Player and Gate
    • UI Buttons
    • Gates themselves
  • in Update() method,
    • get the distance by using PlyerCasting Class
  • in OnMouseOver() method,
    • if the distance is less than 3
      • Player’s attack is blocked
      • showing the UI Buttons
      • if Action Button is pressed,
        • the collider attached to the gate is disabled
        • update Attack Blocking
        • UI Buttons disappear
        • play the Animations of opening Gate
7
Setting Gate by making hinge with Cube
8
Create Animation for Opening Door
910.png
Turning off Loop in Animation
10
Animation | Legacy
11
Adding Animation
127.png
Adding Script
12-1
Gate Opening