UNITY | Project | RPG Tutorial |22. Main Menu

2
New Scene | Plane
3
Creating Texture
4
Creating Plane | Adding Texture
  • create 2 planes as the background of Main Menu
  • make them stand towards Main Camera
5
Adding Logo to Plane | Shader
6
Texture Created Automatically
  • add logo image
  • after adding an image to Shader, the material is created automatically
7
Child Object
8
Rotating BackGround
  • rotate the background a little for the scene not to be seen though the logo
9
Lighting | Sky Box
10
Adding UI Text
11
Effects – Particle system
12
Adding Particle System
13
Creating UI Buttons
14
Creating Side Bar with UI Button
15
Side Bar
16
Creating UI Button
17
Creating Animation for Sliding Bar
18
Adding Animation
19
Animaiton | Wrap Mode
  • create a UI Button covering all the screen, but invisible
    • for “click anywhere to start”
20
“MenuControl” Script
  • create variables
    • for the empty gameObject, “menuSlider”
  • create a function, SlideMenu(),
    • when the function is activated, play the menu sliding animation

 

21
Adding Script
22
UI Button | On Click() | Adding Function
23
“MenuControl” Script
  • add variables,
    • for UIs to disappear after Side Menu appear
AC_28
Main Menu Working

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

 

UNITY | Project | RPG Tutorial | 19. NavMesh & Boss AI

2
“NPC001” Script
  • when Player finishes the first Quest, change the saying of NPC by changing QuestNumber in QuestManager
3
Adding Trigger for Gate
  • Adding Cube for Trigger for opening Gate
4
“Quest002Start”
  • creating variables
    • for distance between Player and NPC
    • UI – Buttons
  • in Update() method,
    • getting the distance by using PlayerCasting
  • in OnMouseOver() method,
    • if Player is close enough to NPC
      • prevent Player from attacking
      • set the UI Text with messeges for Gate
      • if Action Button pressed
        • allow Player to attack
        • allow Player to use
        • turn off UI Text
ezgif.com-optimize.gif
NPC saying Different
5
Adding Cube as Walkable Ground
  • add Cube as a boundary for the boss to walk
6
Windows – AI – Navigation
7
Navigation | Walkable
8
Naviagtion | Bake
9
Turning off Mesh Renderer
10
NavMesh Agent
11
“SpiderBossAI”
  • create variables
    • where spider boss goes
    • NavMeshAgent
  • in Start() method,
    • make the NavMeshAgent variable NavMeshAgent
  • in Update() method,
    • through the NavMeshAgent variable, set where the boss to go
12
Adding Script
13
Animation
14
Animation | WrapMode
15
Creating Barriers
16
Barriers | Navigation | Non Walakble
17
Barriers | Bake | Bake
  • to prevent the boss from walking through the barriers, bake the barriers Non Walkable
18
SpiderBoss | NavMesh Agent | Radious like Collider
18-1
SpiderBoss Moving
19
Adding Cube as Trigger
  • put Spider Boss in a Cube Object named SpiderBossTrigger as child object
18-2
SpiderBoss Following Player
20
Adding Attack Animation
21
“SpiderBossAttack” Script
  • create variables
    • spider boss itself
    • as flag for attacking
  • in Update() method,
    • if attackTrigger is 0
      • make the boss walk with the animation
    • if attackTrigger is 0
      • if dealDamage  is 0
        • get the boss attack by player the animation
        • get the coroutine TakingDamage started
  • create IEnumerator TakingDamage()
    • set dealDamage into 2
    • wait for 1.1 sec
    • if spider’s status is not dead
      • get rid of one heart of Player
    • wait for 0.5 sec
    • set dealDamage into 0
  • in OnTriggerEnter() method,
    • when the boss touches Player, set attackTrigger into 1
  • in OnTriggerExit() method,
    • when Player gets out of the boss, set attackTrigger into 0
22
Adding Script
  • Adding Script
  • put SpiderBoss in the script
22-1
Spider Boss Following & Attacking Player

UNITY | PROJECT | RPG Tutorial |8. Completing Quests

2
“QuestButton” Script
  • add GameObjects for indicating that we have taken the quest
  • set the GameObject off when the function, AcceptQuest() is activated
3-0
Adding Components to Script
3-1
Taking Quest
4
“QuestButton” Script
  • create a function, DeclineQuest()
  • make things not have happend
5-01.png
Setting Action for Button
5-1
Declining Quest
6
“GlobalEXP” Script
11
“GlobalEXP” Script
  • Be careful with the order of variables
    • we are going to show internalEXP variable, which is the path for currentEXP , static variable
    • so, put the static variable in the path variable

 

7
“GlobalEXP” GameObject
8
Creating Trigger
9
“QuestComplete” Script
  • Create Variables
  • in Update() method,
    • get the distance between the trigger and Player
  • in OnMouseOver() method,
    • when the distance is lower than a specific value,
      • turn on the UI
      • put the text in the UI
      • if Action button is pressed,
        • turn off the marker
        • add EXP by 100
        • turn off the UIs
        • turn off the Trigger
  • in OnMouseExit() method,
    • turn off the UIs
10-0
Adding Components in Script
10-1
Be Careful with the Component Structure
  • even though the marker is on from the first moment, with the fact that the marker belongs to a GameObject which is turned off, the marker is off automatically
  • move the maker outside of the object
12-0
QuestTrigger” Script
  • add variables for exMarker and Trigger
  • when retrieving the Sword from the chest, turn on the marker and trigger in the notice board
12-1
Declining Quest
12-2
Taking Quest
12-3
Retrieving Sword
12-4
Completing Quest

13

UNITY | PROJECT | RPG Tutorial |6. UI Buttons

2
Adding UI – Panel
3
Adding UI-Text
4
Adding Aceept Button |  UI-Button
5
Adding Font
6
Adding Font
7
Adding Decline Button
7-1
Buttons Working
8
Adding Quest Infromation | UI-Text
9
Creating Animation | Animation Tap
11
Creating Animation | Animation Tap
12
Creating Animation | Animation Tap
13
Creating Animation | Animation Tap
14
Crating Animation | Animation Tap
  • for the Quest Information UIs to appear with Animation, Create an Animation
    • For 0s, 60s, 6s, and 8s, change the Alpha value
10
Animation | Loop Time.
  • Animation Created
  • Deselect Loop time to prevent UI from appearing continously
15
Duplicating UI
202.png
“QuestManager” Script
  • create a script for Quests
  • create a static variable to use it in the other script(class)
  • create another variable a path for the static variable
  • in Update() method,
    • update the quest number
16
“Quest001 Buttons” script
  • create GameObjects variable as references
  • create a function, AcceptQuest(),
    • make Player and noticeCamera Active
    • make UI QuestLabel Inactive
    • start a Coroutine, SetQuestUI()
  • Create an IEnumerator()
    • put texts in the UIs
      • UI has Text component in itself
      • Getcomponent<>().text means accessing the text component
      • make UIs appear in order by using Coroutine
      • finally, make the UIs disappear
17
Creating QuestButtonManager from Empty GameObject
18
Setting Quest UIs off

18-1

19
Setting Acting for Button
  • in Accept Button,
    • add QuestButtonManager into On Click()
    • set the Action by accessing Quest001Button script
21
“Quest001” Script
  • for the mouse cursor to appear
    • add Screen.lockCursor
    • add Cursor.visible