Professional Documents
Culture Documents
AdventureTutorialSlides PDF
AdventureTutorialSlides PDF
Phase 02 - Inventory
Phase 03 - Conditions
Unite 2016 - Training Day
What you need to know
• Phase Asset Store projects:
• Each phase has it’s own Asset Store project you will
need to download and import
INT
INT
INT
INTERACTABLE
INT
IF CONDITION(S)
THEN REACTION(S)
INT
ELSE REACTION(S)
PICTURE INTERACTABLE
INT
IF ( NO CONDITION)
ELSE INT
T “He Looks trustworthy”
Play Voiceover
INT
INT
INT
Load Scene
INT Maintain Inventory
& Scene State
GUARD
• EventSystem
• EventSystem
• NavMesh
• EventSystem
• NavMesh
• Animator
• EventSystem
• NavMesh
• Animator
• Prefabs
Unite 2016 - Training Day
Project Overview
Inventory
• UI System
• UI System
• Editor Scripting
• Conditions
• Conditions
• Reactions
• Conditions
• Reactions
• Interactables
Extension Methods
• 2016 - Training Day
Unite
Project Overview
Interaction System - Reactions
• Polymorphism
• Polymorphism
• Polymorphism
• Serialization
• Interactable Geometry
• Interactable Geometry
• EventSystem
• Interactable Geometry
• EventSystem
• Scene Manager
• Scene Manager
• ScriptableObjects as temporary runtime data storage
• Scene Manager
• ScriptableObjects as temporary runtime data storage
• Delegates
• Scene Manager
• ScriptableObjects as temporary runtime data storage
• Delegates
• Lambda Expressions
Unite 2016 - Training Day
Project Overview
Game Start
Load
Load
Persistent Scene
Persistent Scene
Scene 1 Scene 2
Persistent Scene
Scene 1 Scene 2
Persistent Scene
Scene 1 Scene 2
Persistent Scene
Scene 1 Scene 2
Persistent Scene
Scene 1
Scene 2
Persistent Scene
Scene 1
Scene 2
Persistent Scene
Scene 1
Scene 2
Persistent Scene
Scene 1
Scene 2
Persistent Scene
Unload Scene
Scene 1
Scene 2
Persistent Scene
Unload Scene
Scene 1 Scene 2
Persistent Scene
Scene 1 Scene 2
Persistent Scene
Scene 1 Scene 2
Persistent Scene
Scene 1 Scene 2
Persistent Scene
Scene 2
Scene 1
Persistent Scene
Scene 2
Scene 1
Persistent Scene
Scene 2
Scene 1
InteractionLocation
Interact
Unite 2016 - Training Day
The Player Phase 1/6
Approach
• Animator state machine to control and play all of the
character animations; including idle, walking and interaction
Idle
WagglyArms
Event Systems
1. Send events
2. Receive events
3. Manage events
1. Send events
2. Receive events
3. Manage events
The EventSystem
Unite 2016 - Training Day
The Player Phase 1/6
The Event System
1. Send events
2. Receive events
3. Manage events
The EventSystem
Unite 2016 - Training Day
The Player Phase 1/6
The Event System
1. Send events
2. Receive events
3. Manage events
The EventSystem
Unite 2016 - Training Day
The Player Phase 1/6
The Event System
1. Send events
2. Receive events
3. Manage events
The EventSystem
Unite 2016 - Training Day
The Player Phase 1/6
The Event System
1. Send events
2. Receive events
3. Manage events
The EventSystem
Unite 2016 - Training Day
The Player Phase 1/6
The Event System
1. Send events
2. Receive events
3. Manage events
The EventSystem
Unite 2016 - Training Day
The Player Phase 1/6
1. Navigate to the Hierarchy
3. Name it ClickToMove
• AttemptTake
• HighTake
• MedTake
• LowTake
• PlayerIdleBlender
• PlayerWalk
• PlayerRun
3. Select Speed
• Attempt
• High
• Mid
• Low
2. Make Transitions from each of the PlayerTakeObject...
states to Walking
Unite 2016 - Training Day
The Player Phase 1/6
1. Select the Transition from Walking to PlayerIdle
• Less
• 0.1
Unite 2016 - Training Day
The Player Phase 1/6
1. Select the Transition from PlayerIdle to Walking
• 0.1
Unite 2016 - Training Day
The Player Phase 1/6
1. Select each of the Transitions from Any State to each
of the PlayerTakeObject... states
3. Select Walking
Player Prefab
PlayerMovement script
Destination
Destination
Destination
Moving
Destination
Moving
Destination
Slowing Moving
Destination
Slowing Moving
Destination
5. Select PlayerMovement.OnGroundClick()
2. Test
4. Select PlayerMovement.OnInteractableClick()
2. Test
Scene 1 Scene 2
AddItem RemoveItem
Hierarchy
UI Canvas
Hierarchy
UI Canvas
UI Object 01
Hierarchy
UI Canvas
UI Object 01
UI Object 02
Hierarchy
UI Canvas
UI Object 01
UI Object 02
UI Object 03
Hierarchy
UI Canvas
UI Object 01
UI Object 02
UI Object 03
Item script
Inventory script
Field SerializedProperty
SerializedProperty
Interact
Interactable
Conditions
sReactions
!
Unite 2016 - Training Day
Interaction System Phases 3-5
Approach
• The Interactable GameObject will be:
• stand-alone and hold all logic & events
• decoupled from the actual props in the scene
Interactable
Conditions
sReactions
ConditionCollection
Condition
ReactionCollection
Condition
Reaction
Reaction
Unite 2016 - Training Day
Interaction System Phases 3-5
Approach
• Conditions are:
Interactable
Reaction
Interactable
Conditions
Interactable
Conditions
Description
Interactable
Conditions
Description
Satisfied
Interactable AllConditions
Conditions
Description
Satisfied
Interactable AllConditions
Conditions Conditions
Description Description
Satisfied Satisfied
Interactable AllConditions
Conditions Comparison Conditions
Description Description
Satisfied Satisfied
Reaction
Interactable AllConditions
Conditions Comparison Conditions
Description Description
Satisfied Satisfied
Comparison
Reaction
Reaction
Conditions
Description
Satisfied
Reaction AllConditions
Conditions Conditions
Description Description
Satisfied Satisfied
Reaction AllConditions
Reference
Conditions Conditions
Description Description
Satisfied Satisfied
Reaction AllConditions
Reference
Conditions Conditions
Description Description
Satisfied Satisfied
Satisfied
Reaction AllConditions
Reference
Conditions Conditions
Description Description
Satisfied Ch a n g i n g Satisfied
Satisfied
public class Enemy public class Orc: Enemy public class OrcChieftan: Orc
Interactable InteractableEditor
ConditionCollection serializedObject
Condition subEditors
Condition
ConditionCollection
Condition
Condition
Interactable InteractableEditor
ConditionCollection serializedObject
Condition subEditors
ConditionCollectionEditor
Condition serializedObject
subEditors
ConditionCollection
Condition
Condition
ConditionCollectionEditor
ReactionCollection script
public class Enemy public class Orc : Enemy public class OrcChieftan : Orc
public class Goblin : Enemy
Reaction : ScriptableObject
public Reaction[] reactions; // TextReaction, AudioReaction, AnimationReaction
Reaction : ScriptableObject
public Reaction[] reactions; // TextReaction, AudioReaction, AnimationReaction
ReactionCollection
Reaction : ScriptableObject
public Reaction[] reactions; // TextReaction, AudioReaction, AnimationReaction
ReactionCollection
TextReaction
AudioReaction
AnimationReaction
3. Name it TextReaction
3. Name it TextReactionEditor
1. Send events
2. Receive events
3. Manage events
1. Send events
2. Receive events
3. Manage events
1. Send events
2. Receive events
3. Manage events
1. Send events
2. Receive events
3. Manage events
1. Send events
2. Receive events
3. Manage events
1. Send events
2. Receive events
3. Manage events
Glasses Reaction
Default Reaction
3. Name it Interactable
Interactable InteractableEditor
ConditionCollection serializedObject
Condition subEditors
Condition
ConditionCollection
Condition
Condition
Interactable InteractableEditor
ConditionCollection serializedObject
Condition subEditors
ConditionCollectionEditor
Condition serializedObject
subEditors
ConditionCollection
Condition
Condition
3. Name it Interactable
3. Test
Scene 1 Scene 2
Scene 2
1
Scene Loading…
Unite 2016 - Training Day
Game State Phase 6/6
Brief
Create a system to transition between scenes
Persistent Scene
Persistent Scene
Scene 1 Scene 2
Unite 2016 - Training Day
Game State Phase 6/6
Approach
• Certain information that needs to persist throughout all
scenes (eg: the inventory) can be stored in the “persistent”
scene
Persistent Scene
Scene 2
Scene 1
Unite 2016 - Training Day
Game State Phase 6/6
Approach
• The Persistent scene is not suitable to store all
information, such as details about GameObjects that
exist only in one particular scene (eg: the bird)
Persistent Scene
Scene 1 Scene 2
ScriptableObject
Scene 1 Scene 2
AllConditions
Scene 1 Persistent
Scene 1
AllConditions
Scene 1 Persistent
Scene 1
AllConditions
Scene 1 Persistent
Scene 1
AllConditions
Scene 2 Persistent
Scene 2
AllConditions
Scene 2 Persistent
Scene 2
Scene 1
Asset
Scene 1
Asset
Scene 1
Asset
Scene 1
Asset
Scene 1
Asset
Scene 1
Asset
Scene 1
Asset
Market
Asset
Market
Coin
Asset
Market
Coin
GameObjectActivitySaver script
Asset
Market
Coin
GameObjectActivitySaver script
MarketSaveData
Market
Coin
GameObjectActivitySaver script
MarketSaveData Coin
2. The above Action can store a function that returns void and takes in a
single integer parameter as below
public void MyFunction (int myInt)
{
}
Action<int> myIntegerAction = MyFunction;
This:
Action<string> myAction = SomeFunction;
private void SomeFunction (string name)
{
print(name);
}
Becomes this:
Action<string> myAction = name => {print (name);};
SceneController Script
SaveData Script