UNITY | PROJECT | RPG Tutorial |5. RayCasting

2
Creating “PlayerCasting” script
3
“PlayerCasting” script
  • creating a static variable for the distance of RayCasting
    • create another variable as a internal path for the static variable
  • in Update() method,
    • imply a RayCasting from the mission board, with the direction of forward
    • with out keyword, put the information of RayCasting into hit variable
    • put the distance between the mission board and player in toTarget
    • connect the static variable and the path variable
3-1
RayCasting Working
4
Creating Text UI for indicating Key
5
Creating Text UI for indicating Action
6
InputManager | Adding a button
7
Adding a quest note with Plane
8
“Quest001” Script
  • creating Variables
  • in Update() method,
    • put the distance from the RayCasting in PlayerCasting Class  into “distance
      • for this, distanceFromTarget is set as Static
  • in OnMouseOver() method,
    • if the distance of RayCasting is less than 3,
      • set ActionButton and ActionText active
      • if Action button is pressed,
        • set actionButton, ActionText, and Player inactive
        • set UIQuest and Notice Camera active
  • in OnMouseExit() method,
    • set actionButton and actionText inactive
10
Adding RawImage UI | Making Notice UI for Quest
11
Setting Components off as default value
12
Notice Camera for the Quest
13
Making a Trigger with Cube
14
Making a Trigger with Cube
  • Be careful with the position of Triggers
  • If it’s buried in the other objects like the notice board, it is not detected by RayCasting
15
Put Components in the script
15-1
RayCasting Working
15-2
Action Working

UNITY | PROJECT | RPG Tutorial |3. HUD, UI, & Environment(Water)

2-0
Making the soil a little higher
2-1
Smoothing the soil
2-2
Lower the soil a little for water to flow
3-0
Creating Water
  • import water from Unity Standard Asset
  • Water is just an object concrete
3-1
Modifying Water
4-0
Water Modified
4-1
Water
5
Adding another Tree
68.png
Tree
7
UI – RawImage
  • add UI – RawImage
    • The Raw Image control displays a non-interactive image to the user
    • Since the Raw Image does not require a sprite texture, you can use it to display any texture available to the Unity player
8-0
Canvas | Screen through Camera
  • the white line means our monitor’s screen

 

8-1
Rawimage working
9
RawImage | Anch
  • PosX & PosY means the RawImage is apart from the anchor(Top-Left) by 75
10
Adding Heart Texture to RawImage
11
Creating a blank space for Heart
12
Blank Heart Anchored Top-Left
13
Heart Anchored Center | Child Object of Blank Heart
  • Since ViewHearts are Child Object of Heart, their position is based on the Heart’s
14
Making Heart Indicator by Duplicating
15
“HeartMonitor” Script
  • Create Variables
    • to use in another script make heartValue as Static
    • internalHeart is to be used as a path to heartValue
    • to use Heart, Create GameObject as a vessel
  • in Update() method,
    • create if statement, making Heart Active, whenever Player collects one
16
“Heathcollects” Scritp
17-0
Creating HealthMonitor from Empty GameObject | Adding Hearts to Script
17-1
Collecting Heart & HeartMonitor Working
18-0
“HeartMonitor” Script
  • in Start() method
    • set the initial value of heartValue as 1

 

 

18-1
Collecting Hearts

 

“when Unity says, “There are 2 audio lister”, remove main camera if you are using FPS Character”