UNITY | PROJECT | RPG Tutorial |14. Enemy AI

2
“SpiderAI” Script
  • create a variable for Player
  • in Update() method,
    • make Spider keep looking at Player by using transform.Lookat()
3
Adding Script
4
“SpiderAI”
  • create variables for
    • Player
    • distance obtained by RayCasting
    • distance where Enemy starts to move towards Player
    • Spider itself
    • speed of Spider
    • attack trigger to indicate when spider starts to attack
    • for RayCasting
  • in Update() method,
    • put the information from RayCasting to the RayCastingHit variable
    • put the distance from RayCasting into the variable for distance
    • if Player is within the minimum range of Spider,
      • set the speed of Spider
      • if attackTrigger is 0,
        • make Spider move with the animation, “walk”, toward Player by setting its tranform
    • if Player has left from the range of Spider,
      • set the speed of Spider into 0
      • make Spider idlen with the animation, “idle”
5-1
AI Working : Walking
5
Adding Script
6
“SpiderAI” Script
  • in Update() method,
    • add another if statement,
      • if attackTrigger is 1
        • set the speed of Spider into 0
        • make spider attack with animation, “attack”
  • in OntriggerEnter() method,
    • when spider touches somthing(Player), set attackTrigger into 1
  • in OntriggerExit() method,
    • when Player has escaped Spider, set attackTrigger into 0 to make it stop attack
7-2
AI Working : Attacking
7
Adding Collider
  • add Mesh Collider to Player
    • Convex, and is Trigger

UNITY | PROJECT | RPG Tutorial |4. Building & Animation

2
Importing Modeling of House
3-0
Adding House
3-1
House | no Collider
4-0
Adding Box Collider to House
4-1
Box Collider Stupid
5-0
Adding Mesh Collider to House

 

5-1
House with Mesh Collider

 

6
Adding Houses

 

7
Adding Mushroom | NormalMap Texture
8
Adding Mushrooms
9
Adding Mission Board
106.png
Adding Mission Indicator with 3d Objects
116.png
Creating Material to change Color
12
Applying Material
13
Adding Animation to Mission Indicator | Animation Tab
  • by selecting the object we want to add Animation, in Animation tab, Press Create
14
Creating Animation
154.png
Animation File Created
16
Creating Animation | First Frame
172.png
Creating Animation | 60th Frame
182.png
Crating Animation 180th Frame
  • for those frames, change TransForm.Position to make the indicator move

 

19
Animation done
20-0
Animation | Animator Tab
20-1
Simple Animation
21
House with no NornamlMap Texture
22
House with NormalMap Texturue

UNITY TUTORIAL | PROJECT | SPACE SHOOTER |2. The Player Game Object

UNITY TUTORIAL | PROJECT | SPACE SHOOTER |2. The Player Game Object

2
Adding Player GameObject
3
Resetting the position of “Player” into (0, 0, 0)
4
Transform.Position set to (0, 0, 0)
56.png
RigidBody Added | Gravity Unactivated
6
Capsule Collider Added
ezgif.com-video-to-gif
Changing Collider Size
8
Changing the direction of Collider into Z-Axis for configuration
9
Changing the Radius and Height of Collider
10
Adding “Mesh Collider” | only one collider should be added
11
“Mesh Renderer” off to see “Mesh Collider”
13
Simplified “Mesh” added to “Mesh Collider”
14
“Particle” added as Child GameObject of  “Player”
ezgif.com-video-to-gif 복사본
“Particle” effect