├── .gitattributes
├── .gitignore
├── Readme.md
└── UAIPC
├── Assets
├── Maps.meta
├── Maps
│ ├── arena.map
│ ├── arena.map.meta
│ ├── test.map
│ └── test.map.meta
├── Materials.meta
├── Materials
│ ├── Agent.mat
│ ├── Agent.mat.meta
│ ├── Dummy.mat
│ ├── Dummy.mat.meta
│ ├── Enemy.mat
│ ├── Enemy.mat.meta
│ ├── Floor.physicMaterial
│ ├── Floor.physicMaterial.meta
│ ├── Obstacle.mat
│ ├── Obstacle.mat.meta
│ ├── Orange.mat
│ ├── Orange.mat.meta
│ ├── Player.mat
│ ├── Player.mat.meta
│ ├── Puck.physicMaterial
│ ├── Puck.physicMaterial.meta
│ ├── Purple.mat
│ ├── Purple.mat.meta
│ ├── Wall.physicMaterial
│ └── Wall.physicMaterial.meta
├── Prefabs.meta
├── Prefabs
│ ├── Agent.prefab
│ ├── Agent.prefab.meta
│ ├── Enemy.prefab
│ ├── Enemy.prefab.meta
│ ├── ObstacleGrid.prefab
│ ├── ObstacleGrid.prefab.meta
│ ├── PathNode.prefab
│ ├── PathNode.prefab.meta
│ ├── Player.prefab
│ ├── Player.prefab.meta
│ ├── VertexDirichlet.prefab
│ ├── VertexDirichlet.prefab.meta
│ ├── VertexGrid.prefab
│ ├── VertexGrid.prefab.meta
│ ├── VertexVisibility.prefab
│ └── VertexVisibility.prefab.meta
├── Scenes.meta
├── Scenes
│ ├── Ch01Behaviours.meta
│ ├── Ch01Behaviours
│ │ ├── Arriving.unity
│ │ ├── Arriving.unity.meta
│ │ ├── AvoidingAgents.unity
│ │ ├── AvoidingAgents.unity.meta
│ │ ├── AvoidingWalls_Priority.unity
│ │ ├── AvoidingWalls_Priority.unity.meta
│ │ ├── AvoidingWalls_Weight.unity
│ │ ├── AvoidingWalls_Weight.unity.meta
│ │ ├── Evading.unity
│ │ ├── Evading.unity.meta
│ │ ├── Facing.unity
│ │ ├── Facing.unity.meta
│ │ ├── FollowingPath.unity
│ │ ├── FollowingPath.unity.meta
│ │ ├── Jumping.unity
│ │ ├── Jumping.unity.meta
│ │ ├── Leaving.unity
│ │ ├── Leaving.unity.meta
│ │ ├── PredictingProjectilesLandingSpot.unity
│ │ ├── PredictingProjectilesLandingSpot.unity.meta
│ │ ├── Pursuing.unity
│ │ ├── Pursuing.unity.meta
│ │ ├── ShootingProjectile.unity
│ │ ├── ShootingProjectile.unity.meta
│ │ ├── SteeringPipeline.unity
│ │ ├── SteeringPipeline.unity.meta
│ │ ├── TargetingProjectile.unity
│ │ ├── TargetingProjectile.unity.meta
│ │ ├── Wandering.unity
│ │ └── Wandering.unity.meta
│ ├── Ch02Navigation.meta
│ ├── Ch02Navigation
│ │ ├── CustomMesh.unity
│ │ ├── CustomMesh.unity.meta
│ │ ├── GraphGrid.unity
│ │ ├── GraphGrid.unity.meta
│ │ ├── GraphVisibility.unity
│ │ └── GraphVisibility.unity.meta
│ ├── Ch03DecisionMaking.meta
│ ├── Ch03DecisionMaking
│ │ ├── FiniteStateMachines.unity
│ │ └── FiniteStateMachines.unity.meta
│ ├── Ch08Miscellaneous.meta
│ └── Ch08Miscellaneous
│ │ ├── AirHockeyRival.unity
│ │ ├── AirHockeyRival.unity.meta
│ │ ├── Random.unity
│ │ └── Random.unity.meta
├── Scripts.meta
└── Scripts
│ ├── Ch01Behaviours.meta
│ ├── Ch01Behaviours
│ ├── Actuator.cs
│ ├── Actuator.cs.meta
│ ├── Agent.cs
│ ├── Agent.cs.meta
│ ├── AgentBehaviour.cs
│ ├── AgentBehaviour.cs.meta
│ ├── AgentPlayer.cs
│ ├── AgentPlayer.cs.meta
│ ├── Align.cs
│ ├── Align.cs.meta
│ ├── Arrive.cs
│ ├── Arrive.cs.meta
│ ├── AvoidAgent.cs
│ ├── AvoidAgent.cs.meta
│ ├── AvoidWall.cs
│ ├── AvoidWall.cs.meta
│ ├── Constraint.cs
│ ├── Constraint.cs.meta
│ ├── Decomposer.cs
│ ├── Decomposer.cs.meta
│ ├── Evade.cs
│ ├── Evade.cs.meta
│ ├── Face.cs
│ ├── Face.cs.meta
│ ├── Flee.cs
│ ├── Flee.cs.meta
│ ├── Goal.cs
│ ├── Goal.cs.meta
│ ├── Jump.cs
│ ├── Jump.cs.meta
│ ├── JumpLocation.cs
│ ├── JumpLocation.cs.meta
│ ├── JumpPoint.cs
│ ├── JumpPoint.cs.meta
│ ├── LandingLocation.cs
│ ├── LandingLocation.cs.meta
│ ├── Leave.cs
│ ├── Leave.cs.meta
│ ├── Path.cs
│ ├── Path.cs.meta
│ ├── PathFollower.cs
│ ├── PathFollower.cs.meta
│ ├── PathSegment.cs
│ ├── PathSegment.cs.meta
│ ├── Projectile.cs
│ ├── Projectile.cs.meta
│ ├── ProjectileDirector.cs
│ ├── ProjectileDirector.cs.meta
│ ├── ProjectileDrag.cs
│ ├── ProjectileDrag.cs.meta
│ ├── ProjectilePredictor.cs
│ ├── ProjectilePredictor.cs.meta
│ ├── ProjectileShooter.cs
│ ├── ProjectileShooter.cs.meta
│ ├── Pursue.cs
│ ├── Pursue.cs.meta
│ ├── Seek.cs
│ ├── Seek.cs.meta
│ ├── Steering.cs
│ ├── Steering.cs.meta
│ ├── SteeringPipeline.cs
│ ├── SteeringPipeline.cs.meta
│ ├── Targeter.cs
│ ├── Targeter.cs.meta
│ ├── VelocityMatch.cs
│ ├── VelocityMatch.cs.meta
│ ├── Wander.cs
│ └── Wander.cs.meta
│ ├── Ch02Navigation.meta
│ ├── Ch02Navigation
│ ├── BinaryHeap.cs
│ ├── BinaryHeap.cs.meta
│ ├── CustomNavMesh.cs
│ ├── CustomNavMesh.cs.meta
│ ├── Edge.cs
│ ├── Edge.cs.meta
│ ├── Editor.meta
│ ├── Editor
│ │ ├── CustomNavMeshEditor.cs
│ │ ├── CustomNavMeshEditor.cs.meta
│ │ ├── CustomNavMeshWindow.cs
│ │ └── CustomNavMeshWindow.cs.meta
│ ├── Graph.cs
│ ├── Graph.cs.meta
│ ├── GraphDirichlet.cs
│ ├── GraphDirichlet.cs.meta
│ ├── GraphGrid.cs
│ ├── GraphGrid.cs.meta
│ ├── GraphVisibility.cs
│ ├── GraphVisibility.cs.meta
│ ├── Vertex.cs
│ ├── Vertex.cs.meta
│ ├── VertexDirichlet.cs
│ ├── VertexDirichlet.cs.meta
│ ├── VertexVisibility.cs
│ └── VertexVisibility.cs.meta
│ ├── Ch03DecisionMaking.meta
│ ├── Ch03DecisionMaking
│ ├── Action.cs
│ ├── Action.cs.meta
│ ├── ActionBT.cs
│ ├── ActionBT.cs.meta
│ ├── ActionChooser.cs
│ ├── ActionChooser.cs.meta
│ ├── ActionGOB.cs
│ ├── ActionGOB.cs.meta
│ ├── ActionState.cs
│ ├── ActionState.cs.meta
│ ├── Condition.cs
│ ├── Condition.cs.meta
│ ├── ConditionAnd.cs
│ ├── ConditionAnd.cs.meta
│ ├── ConditionBT.cs
│ ├── ConditionBT.cs.meta
│ ├── ConditionFloat.cs
│ ├── ConditionFloat.cs.meta
│ ├── ConditionTargetClose.cs
│ ├── ConditionTargetClose.cs.meta
│ ├── ConditionTargetFar.cs
│ ├── ConditionTargetFar.cs.meta
│ ├── Decision.cs
│ ├── Decision.cs.meta
│ ├── DecisionBool.cs
│ ├── DecisionBool.cs.meta
│ ├── DecisionFloat.cs
│ ├── DecisionFloat.cs.meta
│ ├── DecisionTree.cs
│ ├── DecisionTree.cs.meta
│ ├── DecisionTreeNode.cs
│ ├── DecisionTreeNode.cs.meta
│ ├── FuzzyDecisionMaker.cs
│ ├── FuzzyDecisionMaker.cs.meta
│ ├── FuzzyRule.cs
│ ├── FuzzyRule.cs.meta
│ ├── GoalGOB.cs
│ ├── GoalGOB.cs.meta
│ ├── MFEnraged.cs
│ ├── MFEnraged.cs.meta
│ ├── MarkovStateMachine.cs
│ ├── MarkovStateMachine.cs.meta
│ ├── MarkovTransition.cs
│ ├── MarkovTransition.cs.meta
│ ├── MembershipFunction.cs
│ ├── MembershipFunction.cs.meta
│ ├── Selector.cs
│ ├── Selector.cs.meta
│ ├── Sequence.cs
│ ├── Sequence.cs.meta
│ ├── State.cs
│ ├── State.cs.meta
│ ├── StateHighLevel.cs
│ ├── StateHighLevel.cs.meta
│ ├── StateIdle.cs
│ ├── StateIdle.cs.meta
│ ├── StateSeek.cs
│ ├── StateSeek.cs.meta
│ ├── Task.cs
│ ├── Task.cs.meta
│ ├── Transition.cs
│ ├── Transition.cs.meta
│ ├── TransitionDecision.cs
│ └── TransitionDecision.cs.meta
│ ├── Ch04TacticsCoordination.meta
│ ├── Ch04TacticsCoordination
│ ├── Attack.cs
│ ├── Attack.cs.meta
│ ├── Character.cs
│ ├── Character.cs.meta
│ ├── Enemy.cs
│ ├── Enemy.cs.meta
│ ├── FightingCircle.cs
│ ├── FightingCircle.cs.meta
│ ├── FormationManager.cs
│ ├── FormationManager.cs.meta
│ ├── FormationPattern.cs
│ ├── FormationPattern.cs.meta
│ ├── Guild.cs
│ ├── Guild.cs.meta
│ ├── GuildRecord.cs
│ ├── GuildRecord.cs.meta
│ ├── InfluenceMap.cs
│ ├── InfluenceMap.cs.meta
│ ├── Location.cs
│ ├── Location.cs.meta
│ ├── Lurker.cs
│ ├── Lurker.cs.meta
│ ├── SlotAssignment.cs
│ ├── SlotAssignment.cs.meta
│ ├── StageManager.cs
│ ├── StageManager.cs.meta
│ ├── Unit.cs
│ ├── Unit.cs.meta
│ ├── VertexInfluence.cs
│ ├── VertexInfluence.cs.meta
│ ├── Waypoint.cs
│ └── Waypoint.cs.meta
│ ├── Ch05AgentAwareness.meta
│ ├── Ch05AgentAwareness
│ ├── AgentAwared.cs
│ ├── AgentAwared.cs.meta
│ ├── EmitterGraph.cs
│ ├── EmitterGraph.cs.meta
│ ├── Interest.cs
│ ├── Interest.cs.meta
│ ├── InterestSource.cs
│ ├── InterestSource.cs.meta
│ ├── OdourParticle.cs
│ ├── OdourParticle.cs.meta
│ ├── SensoryManager.cs
│ ├── SensoryManager.cs.meta
│ ├── Smeller.cs
│ ├── Smeller.cs.meta
│ ├── SoundEmitter.cs
│ ├── SoundEmitter.cs.meta
│ ├── SoundReceiver.cs
│ ├── SoundReceiver.cs.meta
│ ├── VertexOdour.cs
│ ├── VertexOdour.cs.meta
│ ├── Visor.cs
│ ├── Visor.cs.meta
│ ├── VisorGraph.cs
│ └── VisorGraph.cs.meta
│ ├── Ch06BoardGamesAI.meta
│ ├── Ch06BoardGamesAI
│ ├── Board.cs
│ ├── Board.cs.meta
│ ├── BoardAi.cs
│ ├── BoardAi.cs.meta
│ ├── BoardDraughts.cs
│ ├── BoardDraughts.cs.meta
│ ├── BoardTicTac.cs
│ ├── BoardTicTac.cs.meta
│ ├── Move.cs
│ ├── Move.cs.meta
│ ├── MoveDraughts.cs
│ ├── MoveDraughts.cs.meta
│ ├── MoveTicTac.cs
│ ├── MoveTicTac.cs.meta
│ ├── PieceDraughts.cs
│ └── PieceDraughts.cs.meta
│ ├── Ch07LearningTechniques.meta
│ ├── Ch07LearningTechniques
│ ├── DecisionNode.cs
│ ├── DecisionNode.cs.meta
│ ├── HarmonySearch.cs
│ ├── HarmonySearch.cs.meta
│ ├── HierarchicalNGramP.cs
│ ├── HierarchicalNGramP.cs.meta
│ ├── ID3.cs
│ ├── ID3.cs.meta
│ ├── ID3Example.cs
│ ├── ID3Example.cs.meta
│ ├── KeyDataRecord.cs
│ ├── KeyDataRecord.cs.meta
│ ├── MLPNetwork.cs
│ ├── MLPNetwork.cs.meta
│ ├── NGramPredictor.cs
│ ├── NGramPredictor.cs.meta
│ ├── NaiveBayesClassifier.cs
│ ├── NaiveBayesClassifier.cs.meta
│ ├── Perceptron.cs
│ ├── Perceptron.cs.meta
│ ├── QLearning.cs
│ ├── QLearning.cs.meta
│ ├── QValueStore.cs
│ ├── QValueStore.cs.meta
│ ├── ReinforcementProblem.cs
│ └── ReinforcementProblem.cs.meta
│ ├── Ch08Miscellaneous.meta
│ ├── Ch08Miscellaneous
│ ├── AirHockeyRival.cs
│ ├── AirHockeyRival.cs.meta
│ ├── BSPNode.cs
│ ├── BSPNode.cs.meta
│ ├── Dungeon.cs
│ ├── Dungeon.cs.meta
│ ├── RandomGaussian.cs
│ ├── RandomGaussian.cs.meta
│ ├── TFRBar.cs
│ ├── TFRBar.cs.meta
│ ├── TFRival.cs
│ ├── TFRival.cs.meta
│ ├── Track.cs
│ ├── Track.cs.meta
│ ├── TrackSection.cs
│ └── TrackSection.cs.meta
│ ├── Utils.meta
│ └── Utils
│ ├── TesterGraph.cs
│ └── TesterGraph.cs.meta
└── ProjectSettings
├── AudioManager.asset
├── ClusterInputManager.asset
├── DynamicsManager.asset
├── EditorBuildSettings.asset
├── EditorSettings.asset
├── GraphicsSettings.asset
├── InputManager.asset
├── NavMeshAreas.asset
├── NavMeshLayers.asset
├── NetworkManager.asset
├── Physics2DSettings.asset
├── ProjectSettings.asset
├── ProjectVersion.txt
├── QualitySettings.asset
├── TagManager.asset
├── TimeManager.asset
├── UnityAdsSettings.asset
└── UnityConnectSettings.asset
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows thumbnail cache files
2 | Thumbs.db
3 | ehthumbs.db
4 | ehthumbs_vista.db
5 |
6 | # Folder config file
7 | Desktop.ini
8 |
9 | # Recycle Bin used on file shares
10 | $RECYCLE.BIN/
11 |
12 | # Windows Installer files
13 | *.cab
14 | *.msi
15 | *.msm
16 | *.msp
17 |
18 | # Windows shortcuts
19 | *.lnk
20 |
21 | # =========================
22 | # Operating System Files
23 | # =========================
24 |
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ### Download a free PDF
5 |
6 | If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.
7 |
https://packt.link/free-ebook/9781783553570
--------------------------------------------------------------------------------
/UAIPC/Assets/Maps.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 73f6f522cff712641a956d7a524836ee
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Maps/arena.map:
--------------------------------------------------------------------------------
1 | type octile
2 | height 49
3 | width 49
4 | map
5 | TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
6 | TTT............TTTT.TTT...TTTT.TTTT............TT
7 | TT.............TTT........TTT..TTT.............TT
8 | T...............................................T
9 | T...............................................T
10 | T...............................................T
11 | T...............................................T
12 | T.......................TT......................T
13 | T......................TTT......................T
14 | T......................TTT......................T
15 | T...............................................T
16 | T...............................................T
17 | T...............................................T
18 | T...............................................T
19 | T...............................................T
20 | TTT............TTTT............TTTT............TT
21 | TTT............TTTT............TTTT............TT
22 | TTT............TTTT............TTTT............TT
23 | TT.............TTT.............TTT.............TT
24 | TT..............................................T
25 | TT..............................................T
26 | TT..............................................T
27 | TT..............................................T
28 | T...............................................T
29 | T...............................................T
30 | T...............................................T
31 | TT..............................................T
32 | TTT.............................................T
33 | TTT.............................................T
34 | TTT.............................................T
35 | T...............................................T
36 | TTT............TTTT............TTTT............TT
37 | TTT............TTTT............TTTT............TT
38 | TTT............TTTT............TTTT............TT
39 | TT.............TTT.............TTT.............TT
40 | T...............................................T
41 | T...............................................T
42 | T...............................................T
43 | T...............................................T
44 | T...............................................T
45 | T...............................................T
46 | T...............................................T
47 | T...............................................T
48 | T...............................................T
49 | T...............................................T
50 | T...............................................T
51 | T...................TTT...TTT...................T
52 | TTT............TTTT.TTTT..TTTT.TTTT............TT
53 | TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
54 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Maps/arena.map.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 91bb5359a8271b5478b379b97f24c990
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Maps/test.map:
--------------------------------------------------------------------------------
1 | type octile
2 | height 4
3 | width 4
4 | map
5 | TTTT
6 | T..T
7 | T..T
8 | TTTT
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Maps/test.map.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f0bfa4f0e75119148adf1e5b8c795be1
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6ebbbf7b70383a646b0b6fb0b9d549c4
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Agent.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 3
6 | m_ObjectHideFlags: 0
7 | m_PrefabParentObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Agent
10 | m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
11 | m_ShaderKeywords: []
12 | m_CustomRenderQueue: -1
13 | m_SavedProperties:
14 | serializedVersion: 2
15 | m_TexEnvs:
16 | data:
17 | first:
18 | name: _MainTex
19 | second:
20 | m_Texture: {fileID: 0}
21 | m_Scale: {x: 1, y: 1}
22 | m_Offset: {x: 0, y: 0}
23 | data:
24 | first:
25 | name: _BumpMap
26 | second:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | data:
31 | first:
32 | name: _DecalTex
33 | second:
34 | m_Texture: {fileID: 0}
35 | m_Scale: {x: 1, y: 1}
36 | m_Offset: {x: 0, y: 0}
37 | m_Floats: {}
38 | m_Colors:
39 | data:
40 | first:
41 | name: _Color
42 | second: {r: .0908304304, g: .5548262, b: .882352948, a: 1}
43 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Agent.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 49cbc03c63da153429ee8fe21cdc00b3
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Dummy.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 3
6 | m_ObjectHideFlags: 0
7 | m_PrefabParentObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Dummy
10 | m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
11 | m_ShaderKeywords: []
12 | m_CustomRenderQueue: -1
13 | m_SavedProperties:
14 | serializedVersion: 2
15 | m_TexEnvs:
16 | data:
17 | first:
18 | name: _MainTex
19 | second:
20 | m_Texture: {fileID: 0}
21 | m_Scale: {x: 1, y: 1}
22 | m_Offset: {x: 0, y: 0}
23 | m_Floats: {}
24 | m_Colors:
25 | data:
26 | first:
27 | name: _Color
28 | second: {r: 1, g: 1, b: 1, a: 1}
29 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Dummy.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9ad822fcb0a412f4b9dfed3516d76004
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Enemy.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 3
6 | m_ObjectHideFlags: 0
7 | m_PrefabParentObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Enemy
10 | m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
11 | m_ShaderKeywords: []
12 | m_CustomRenderQueue: -1
13 | m_SavedProperties:
14 | serializedVersion: 2
15 | m_TexEnvs:
16 | data:
17 | first:
18 | name: _MainTex
19 | second:
20 | m_Texture: {fileID: 0}
21 | m_Scale: {x: 1, y: 1}
22 | m_Offset: {x: 0, y: 0}
23 | m_Floats: {}
24 | m_Colors:
25 | data:
26 | first:
27 | name: _Color
28 | second: {r: .757352948, g: 0, b: 0, a: 1}
29 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Enemy.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e24c06279c15957448bf82aa0061dc48
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Floor.physicMaterial:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!134 &13400000
4 | PhysicMaterial:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 0}
8 | m_Name: Floor
9 | dynamicFriction: .600000024
10 | staticFriction: .600000024
11 | bounciness: 0
12 | frictionCombine: 0
13 | bounceCombine: 0
14 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Floor.physicMaterial.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f6a93cbc44f8c4c4fbc103f2b8c5081b
3 | timeCreated: 1447622543
4 | licenseType: Free
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Obstacle.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 3
6 | m_ObjectHideFlags: 0
7 | m_PrefabParentObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Obstacle
10 | m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
11 | m_ShaderKeywords: []
12 | m_CustomRenderQueue: -1
13 | m_SavedProperties:
14 | serializedVersion: 2
15 | m_TexEnvs:
16 | data:
17 | first:
18 | name: _MainTex
19 | second:
20 | m_Texture: {fileID: 0}
21 | m_Scale: {x: 1, y: 1}
22 | m_Offset: {x: 0, y: 0}
23 | m_Floats: {}
24 | m_Colors:
25 | data:
26 | first:
27 | name: _Color
28 | second: {r: .397058845, g: .397058845, b: .397058845, a: 1}
29 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Obstacle.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: feebc0a3c2abb2e43b6007c00a97eb11
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Orange.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_PrefabParentObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Orange
10 | m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
11 | m_ShaderKeywords:
12 | m_LightmapFlags: 5
13 | m_CustomRenderQueue: -1
14 | stringTagMap: {}
15 | m_SavedProperties:
16 | serializedVersion: 2
17 | m_TexEnvs:
18 | data:
19 | first:
20 | name: _MainTex
21 | second:
22 | m_Texture: {fileID: 0}
23 | m_Scale: {x: 1, y: 1}
24 | m_Offset: {x: 0, y: 0}
25 | m_Floats: {}
26 | m_Colors:
27 | data:
28 | first:
29 | name: _Color
30 | second: {r: 0.9485294, g: 0.60836715, b: 0, a: 1}
31 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Orange.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e6628c17e59b83946982c41727400899
3 | timeCreated: 1458073531
4 | licenseType: Pro
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Player.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 3
6 | m_ObjectHideFlags: 0
7 | m_PrefabParentObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Player
10 | m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
11 | m_ShaderKeywords: []
12 | m_CustomRenderQueue: -1
13 | m_SavedProperties:
14 | serializedVersion: 2
15 | m_TexEnvs:
16 | data:
17 | first:
18 | name: _MainTex
19 | second:
20 | m_Texture: {fileID: 0}
21 | m_Scale: {x: 1, y: 1}
22 | m_Offset: {x: 0, y: 0}
23 | data:
24 | first:
25 | name: _BumpMap
26 | second:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | data:
31 | first:
32 | name: _DecalTex
33 | second:
34 | m_Texture: {fileID: 0}
35 | m_Scale: {x: 1, y: 1}
36 | m_Offset: {x: 0, y: 0}
37 | m_Floats: {}
38 | m_Colors:
39 | data:
40 | first:
41 | name: _Color
42 | second: {r: .409989864, g: .772058845, b: 0, a: 1}
43 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Player.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b041000c17963174e9df68b014f8a450
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Puck.physicMaterial:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!134 &13400000
4 | PhysicMaterial:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 0}
8 | m_Name: Puck
9 | dynamicFriction: .600000024
10 | staticFriction: .600000024
11 | bounciness: 0
12 | frictionCombine: 0
13 | bounceCombine: 0
14 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Puck.physicMaterial.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2e511823e1a038a45b0759b5c3fe7119
3 | timeCreated: 1447621807
4 | licenseType: Free
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Purple.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 3
6 | m_ObjectHideFlags: 0
7 | m_PrefabParentObject: {fileID: 0}
8 | m_PrefabInternal: {fileID: 0}
9 | m_Name: Purple
10 | m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
11 | m_ShaderKeywords: []
12 | m_CustomRenderQueue: -1
13 | m_SavedProperties:
14 | serializedVersion: 2
15 | m_TexEnvs:
16 | data:
17 | first:
18 | name: _MainTex
19 | second:
20 | m_Texture: {fileID: 0}
21 | m_Scale: {x: 1, y: 1}
22 | m_Offset: {x: 0, y: 0}
23 | m_Floats: {}
24 | m_Colors:
25 | data:
26 | first:
27 | name: _Color
28 | second: {r: .745861948, g: 0, b: .83088237, a: 1}
29 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Purple.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f7943889c79b56b41bf270d45101d49e
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Wall.physicMaterial:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!134 &13400000
4 | PhysicMaterial:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 0}
8 | m_Name: Wall
9 | dynamicFriction: .600000024
10 | staticFriction: .600000024
11 | bounciness: 0
12 | frictionCombine: 0
13 | bounceCombine: 0
14 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Materials/Wall.physicMaterial.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: faf4cb01a7c490243a7d65ea5f312bf5
3 | timeCreated: 1447622233
4 | licenseType: Free
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 32d105b3db4723f41860aa3d146a0eb8
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs/Agent.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: edde7530d68249d4a91574ed3988a50f
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs/Enemy.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bdca98e7fbe1b4f4c889014d5782539c
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs/ObstacleGrid.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1 &100000
4 | GameObject:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 100100000}
8 | serializedVersion: 4
9 | m_Component:
10 | - 4: {fileID: 400000}
11 | - 33: {fileID: 3300000}
12 | - 65: {fileID: 6500000}
13 | - 23: {fileID: 2300000}
14 | m_Layer: 0
15 | m_Name: ObstacleGrid
16 | m_TagString: Wall
17 | m_Icon: {fileID: 0}
18 | m_NavMeshLayer: 0
19 | m_StaticEditorFlags: 0
20 | m_IsActive: 1
21 | --- !u!4 &400000
22 | Transform:
23 | m_ObjectHideFlags: 1
24 | m_PrefabParentObject: {fileID: 0}
25 | m_PrefabInternal: {fileID: 100100000}
26 | m_GameObject: {fileID: 100000}
27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
28 | m_LocalPosition: {x: 0, y: 0, z: 0}
29 | m_LocalScale: {x: 1, y: 1, z: 1}
30 | m_Children: []
31 | m_Father: {fileID: 0}
32 | m_RootOrder: 0
33 | --- !u!23 &2300000
34 | MeshRenderer:
35 | m_ObjectHideFlags: 1
36 | m_PrefabParentObject: {fileID: 0}
37 | m_PrefabInternal: {fileID: 100100000}
38 | m_GameObject: {fileID: 100000}
39 | m_Enabled: 1
40 | m_CastShadows: 1
41 | m_ReceiveShadows: 1
42 | m_Materials:
43 | - {fileID: 2100000, guid: feebc0a3c2abb2e43b6007c00a97eb11, type: 2}
44 | m_SubsetIndices:
45 | m_StaticBatchRoot: {fileID: 0}
46 | m_UseLightProbes: 0
47 | m_ReflectionProbeUsage: 1
48 | m_ProbeAnchor: {fileID: 0}
49 | m_ScaleInLightmap: 1
50 | m_PreserveUVs: 0
51 | m_IgnoreNormalsForChartDetection: 0
52 | m_ImportantGI: 0
53 | m_MinimumChartSize: 4
54 | m_AutoUVMaxDistance: 0.5
55 | m_AutoUVMaxAngle: 89
56 | m_LightmapParameters: {fileID: 0}
57 | m_SortingLayerID: 0
58 | m_SortingOrder: 0
59 | --- !u!33 &3300000
60 | MeshFilter:
61 | m_ObjectHideFlags: 1
62 | m_PrefabParentObject: {fileID: 0}
63 | m_PrefabInternal: {fileID: 100100000}
64 | m_GameObject: {fileID: 100000}
65 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
66 | --- !u!65 &6500000
67 | BoxCollider:
68 | m_ObjectHideFlags: 1
69 | m_PrefabParentObject: {fileID: 0}
70 | m_PrefabInternal: {fileID: 100100000}
71 | m_GameObject: {fileID: 100000}
72 | m_Material: {fileID: 0}
73 | m_IsTrigger: 0
74 | m_Enabled: 1
75 | serializedVersion: 2
76 | m_Size: {x: 1, y: 1, z: 1}
77 | m_Center: {x: 0, y: 0, z: 0}
78 | --- !u!1001 &100100000
79 | Prefab:
80 | m_ObjectHideFlags: 1
81 | serializedVersion: 2
82 | m_Modification:
83 | m_TransformParent: {fileID: 0}
84 | m_Modifications:
85 | - target: {fileID: 0}
86 | propertyPath: m_TagString
87 | value: Obstacle
88 | objectReference: {fileID: 0}
89 | m_RemovedComponents: []
90 | m_ParentPrefab: {fileID: 0}
91 | m_RootGameObject: {fileID: 100000}
92 | m_IsPrefabParent: 1
93 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs/ObstacleGrid.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 403c7d1fcaa50ea4e8acd406751a88fd
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs/PathNode.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1 &100000
4 | GameObject:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 100100000}
8 | serializedVersion: 4
9 | m_Component:
10 | - 4: {fileID: 400000}
11 | - 33: {fileID: 3300000}
12 | - 135: {fileID: 13500000}
13 | - 23: {fileID: 2300000}
14 | m_Layer: 0
15 | m_Name: PathNode
16 | m_TagString: Untagged
17 | m_Icon: {fileID: 0}
18 | m_NavMeshLayer: 0
19 | m_StaticEditorFlags: 0
20 | m_IsActive: 1
21 | --- !u!4 &400000
22 | Transform:
23 | m_ObjectHideFlags: 1
24 | m_PrefabParentObject: {fileID: 0}
25 | m_PrefabInternal: {fileID: 100100000}
26 | m_GameObject: {fileID: 100000}
27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
28 | m_LocalPosition: {x: 0, y: 0, z: 0}
29 | m_LocalScale: {x: 1, y: 1, z: 1}
30 | m_Children: []
31 | m_Father: {fileID: 0}
32 | m_RootOrder: 0
33 | --- !u!23 &2300000
34 | Renderer:
35 | m_ObjectHideFlags: 1
36 | m_PrefabParentObject: {fileID: 0}
37 | m_PrefabInternal: {fileID: 100100000}
38 | m_GameObject: {fileID: 100000}
39 | m_Enabled: 1
40 | m_CastShadows: 1
41 | m_ReceiveShadows: 1
42 | m_LightmapIndex: 255
43 | m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0}
44 | m_Materials:
45 | - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0}
46 | m_SubsetIndices:
47 | m_StaticBatchRoot: {fileID: 0}
48 | m_UseLightProbes: 0
49 | m_LightProbeAnchor: {fileID: 0}
50 | m_ScaleInLightmap: 1
51 | m_SortingLayerID: 0
52 | m_SortingOrder: 0
53 | --- !u!33 &3300000
54 | MeshFilter:
55 | m_ObjectHideFlags: 1
56 | m_PrefabParentObject: {fileID: 0}
57 | m_PrefabInternal: {fileID: 100100000}
58 | m_GameObject: {fileID: 100000}
59 | m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
60 | --- !u!135 &13500000
61 | SphereCollider:
62 | m_ObjectHideFlags: 1
63 | m_PrefabParentObject: {fileID: 0}
64 | m_PrefabInternal: {fileID: 100100000}
65 | m_GameObject: {fileID: 100000}
66 | m_Material: {fileID: 0}
67 | m_IsTrigger: 0
68 | m_Enabled: 1
69 | serializedVersion: 2
70 | m_Radius: .5
71 | m_Center: {x: 0, y: 0, z: 0}
72 | --- !u!1001 &100100000
73 | Prefab:
74 | m_ObjectHideFlags: 1
75 | serializedVersion: 2
76 | m_Modification:
77 | m_TransformParent: {fileID: 0}
78 | m_Modifications: []
79 | m_RemovedComponents: []
80 | m_ParentPrefab: {fileID: 0}
81 | m_RootGameObject: {fileID: 100000}
82 | m_IsPrefabParent: 1
83 | m_IsExploded: 1
84 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs/PathNode.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e21d80611fd411c46b6e933e86fc639c
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs/Player.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0d552b782a490d8498f28bcfebd43b8a
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs/VertexDirichlet.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f752909cced0ba34d89cbbcd97bb223e
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs/VertexGrid.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a0702439d05d5334e885e87aeba2a438
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Prefabs/VertexVisibility.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 61c5544294ab7024a94ade79723e1d74
3 | NativeFormatImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d188fafc852c5bf43873717723823ce6
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 60cdf5de55f623a4da29a82478e6fc1d
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/Arriving.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 940064d2a970ea7459fb7eeac76a9958
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/AvoidingAgents.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8cbaf2c673f72f34f839e91989eb4125
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/AvoidingWalls_Priority.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6f58134cf20226648a91381740bc6641
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/AvoidingWalls_Weight.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8e4539c87fd6b6f4f84ece94805c8aef
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/Evading.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c80b282af6a99374fa42e85ce7dd1990
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/Facing.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c9bf8b1fe48073f4589f32550bf805c1
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/FollowingPath.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 289200d919a3f284abe39c3682b7c55e
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/Jumping.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3679f707c76222f40a6a8acdee13b689
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/Leaving.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e6b21daa021f5c34ab9f5ed2ec8a5c23
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/PredictingProjectilesLandingSpot.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: be56d97e1fc211640bf00b124f5d9617
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/Pursuing.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e40b536b13ad43241bf4da805659380c
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/ShootingProjectile.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 224f2103268e9eb40b9451f06ae9cb72
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/SteeringPipeline.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a83663360c729a842a5a537667182db0
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/TargetingProjectile.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d46098f08b0eb554392a52e4295cd282
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch01Behaviours/Wandering.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 615bd5fe964ff2c42924acc0d6a3af05
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch02Navigation.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6eb27c368da8eed4d805179f8ec210c8
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch02Navigation/CustomMesh.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f2615b7b180c39948868b872f57420be
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch02Navigation/GraphGrid.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1e49fd311cd872942bf111f5c71d6a59
3 | DefaultImporter:
4 | userData:
5 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch02Navigation/GraphVisibility.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e5780589889e04c47a990609622fb2cc
3 | timeCreated: 1458261082
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch03DecisionMaking.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 99279dc771d9e4d4ba6749a63f6b1930
3 | folderAsset: yes
4 | timeCreated: 1458397154
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch03DecisionMaking/FiniteStateMachines.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f3a45031fa6eeb84280dc963ca3f1825
3 | timeCreated: 1458397323
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch08Miscellaneous.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f3e9ad1bd8e0cec4cb0a621e01789d9a
3 | folderAsset: yes
4 | timeCreated: 1447467172
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch08Miscellaneous/AirHockeyRival.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bc4ada3c4cf01eb4ab0fa0b6a688f13e
3 | timeCreated: 1447467382
4 | licenseType: Free
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scenes/Ch08Miscellaneous/Random.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 82d0a4db7da002a458c9ae461fb55855
3 | timeCreated: 1447710608
4 | licenseType: Free
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a62c85ab01e6d2646a8fe1f58b5c66c0
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3d218486dbee50445b76bb09b09491e8
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Actuator.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Actuator : MonoBehaviour
5 | {
6 | public virtual Path GetPath (Goal goal)
7 | {
8 | return new Path();
9 | }
10 |
11 | public virtual Steering GetOutput (Path path, Goal goal)
12 | {
13 | return new Steering();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Actuator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6728e7def543a9043b18c651ad26a5bc
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Agent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fe399c0304a8c8d4a8b4dcd0c21b65c9
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 100
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/AgentBehaviour.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | public class AgentBehaviour : MonoBehaviour
4 | {
5 | public float weight = 1.0f;
6 | public int priority = 1;
7 | public GameObject target;
8 | protected Agent agent;
9 |
10 | public virtual void Awake ()
11 | {
12 | agent = gameObject.GetComponent();
13 | }
14 | public virtual void Update ()
15 | {
16 | if (agent.blendWeight)
17 | agent.SetSteering(GetSteering(), weight);
18 | else if (agent.blendPriority)
19 | agent.SetSteering(GetSteering(), priority);
20 | else if (agent.blendPipeline)
21 | agent.SetSteering(GetSteering(), true);
22 | else
23 | agent.SetSteering(GetSteering());
24 | }
25 | public virtual Steering GetSteering ()
26 | {
27 | return new Steering();
28 | }
29 | public float MapToRange (float rotation) {
30 | rotation %= 360.0f;
31 | if (Mathf.Abs(rotation) > 180.0f) {
32 | if (rotation < 0.0f)
33 | rotation += 360.0f;
34 | else
35 | rotation -= 360.0f;
36 | }
37 | return rotation;
38 | }
39 | public Vector3 OriToVec (float orientation) {
40 | Vector3 vector = Vector3.zero;
41 | vector.x = Mathf.Sin(orientation * Mathf.Deg2Rad) * 1.0f;
42 | vector.z = Mathf.Cos(orientation * Mathf.Deg2Rad) * 1.0f;
43 | return vector.normalized;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/AgentBehaviour.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2ef5152a351c4024bae7f6d8aa7c7612
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 300
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/AgentPlayer.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class AgentPlayer : Agent
5 | {
6 |
7 | public override void Update()
8 | {
9 | velocity.x = Input.GetAxis("Horizontal");
10 | velocity.z = Input.GetAxis("Vertical");
11 | velocity *= maxSpeed;
12 | Vector3 translation = velocity * Time.deltaTime;
13 | transform.Translate(translation, Space.World);
14 | transform.LookAt(transform.position + velocity);
15 | orientation = transform.rotation.eulerAngles.y;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/AgentPlayer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 886aff9ebb8cf9c42b35dfa350eedc4e
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 200
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Align.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Align : AgentBehaviour
5 | {
6 |
7 | public float targetRadius;
8 | public float slowRadius;
9 | public float timeToTarget = 0.1f;
10 |
11 | public override Steering GetSteering()
12 | {
13 | Steering steering = new Steering();
14 | float targetOrientation = target.GetComponent().orientation;
15 | float rotation = targetOrientation - agent.orientation;
16 | rotation = MapToRange(rotation);
17 | float rotationSize = Mathf.Abs(rotation);
18 | if (rotationSize < targetRadius)
19 | return steering;
20 | float targetRotation;
21 | if (rotationSize > slowRadius)
22 | targetRotation = agent.maxRotation;
23 | else
24 | targetRotation = agent.maxRotation * rotationSize / slowRadius;
25 | targetRotation *= rotation / rotationSize;
26 | steering.angular = targetRotation - agent.rotation;
27 | steering.angular /= timeToTarget;
28 | float angularAccel = Mathf.Abs(steering.angular);
29 | if (angularAccel > agent.maxAngularAccel)
30 | {
31 | steering.angular /= angularAccel;
32 | steering.angular *= agent.maxAngularAccel;
33 | }
34 | return steering;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Align.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b58f8b5cea81ad44c9ef086ed46f69d9
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 1000
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Arrive.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Arrive : AgentBehaviour
5 | {
6 | public float targetRadius;
7 | public float slowRadius;
8 | public float timeToTarget = 0.1f;
9 |
10 | public override Steering GetSteering()
11 | {
12 | Steering steering = new Steering();
13 | Vector3 direction = target.transform.position - transform.position;
14 | float distance = direction.magnitude;
15 | float targetSpeed;
16 | if (distance < targetRadius)
17 | return steering;
18 | if (distance > slowRadius)
19 | targetSpeed = agent.maxSpeed;
20 | else
21 | targetSpeed = agent.maxSpeed * distance / slowRadius;
22 | Vector3 desiredVelocity = direction;
23 | desiredVelocity.Normalize();
24 | desiredVelocity *= targetSpeed;
25 | steering.linear = desiredVelocity - agent.velocity;
26 | steering.linear /= timeToTarget;
27 | if (steering.linear.magnitude > agent.maxAccel)
28 | {
29 | steering.linear.Normalize();
30 | steering.linear *= agent.maxAccel;
31 | }
32 | return steering;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Arrive.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9fdf519b7bc56f34497cd9bad1b6eeb4
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 800
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/AvoidAgent.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class AvoidAgent : AgentBehaviour
6 | {
7 | public float collisionRadius = 0.4f;
8 | GameObject[] targets;
9 |
10 | void Start ()
11 | {
12 | targets = GameObject.FindGameObjectsWithTag("Agent");
13 | }
14 |
15 | public override Steering GetSteering()
16 | {
17 | Steering steering = new Steering();
18 | float shortestTime = Mathf.Infinity;
19 | GameObject firstTarget = null;
20 | float firstMinSeparation = 0.0f;
21 | float firstDistance = 0.0f;
22 | Vector3 firstRelativePos = Vector3.zero;
23 | Vector3 firstRelativeVel = Vector3.zero;
24 | foreach (GameObject t in targets)
25 | {
26 | Vector3 relativePos;
27 | Agent targetAgent = t.GetComponent();
28 | relativePos = t.transform.position - transform.position;
29 | Vector3 relativeVel = targetAgent.velocity - agent.velocity;
30 | float relativeSpeed = relativeVel.magnitude;
31 | float timeToCollision = Vector3.Dot(relativePos, relativeVel);
32 | timeToCollision /= relativeSpeed * relativeSpeed * -1;
33 | float distance = relativePos.magnitude;
34 | float minSeparation = distance - relativeSpeed * timeToCollision;
35 | if (minSeparation > 2 * collisionRadius)
36 | continue;
37 | if (timeToCollision > 0.0f && timeToCollision < shortestTime)
38 | {
39 | shortestTime = timeToCollision;
40 | firstTarget = t;
41 | firstMinSeparation = minSeparation;
42 | firstRelativePos = relativePos;
43 | firstRelativeVel = relativeVel;
44 | }
45 | }
46 | if (firstTarget == null)
47 | return steering;
48 | if (firstMinSeparation <= 0.0f || firstDistance < 2 * collisionRadius)
49 | firstRelativePos = firstTarget.transform.position;
50 | else
51 | firstRelativePos += firstRelativeVel * shortestTime;
52 | firstRelativePos.Normalize();
53 | steering.linear = -firstRelativePos * agent.maxAccel;
54 | return steering;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/AvoidAgent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 155d17108995c554286b28014a4abe02
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 1500
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/AvoidWall.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class AvoidWall : Seek
5 | {
6 | public float avoidDistance;
7 | public float lookAhead;
8 |
9 | public override void Awake()
10 | {
11 | base.Awake();
12 | target = new GameObject();
13 | }
14 |
15 | public override Steering GetSteering()
16 | {
17 | Steering steering = new Steering();
18 | Vector3 position = transform.position;
19 | Vector3 rayVector = agent.velocity.normalized * lookAhead;
20 | rayVector += position;;
21 | Vector3 direction = rayVector - position;
22 | RaycastHit hit;
23 | if (Physics.Raycast(position, direction, out hit, lookAhead))
24 | {
25 | position = hit.point + hit.normal * avoidDistance;
26 | target.transform.position = position;
27 | steering = base.GetSteering();
28 | }
29 | return steering;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/AvoidWall.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 36bd6ddae8be01145bbd4e5ac2e77e59
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 1600
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Constraint.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Constraint : MonoBehaviour
5 | {
6 | // Use this for initialization
7 | public virtual bool WillViolate (Path path)
8 | {
9 | return true;
10 | }
11 |
12 | public virtual Goal Suggest (Path path) {
13 | return new Goal();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Constraint.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b447a00d4f4968747b39148e2bcc33ec
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Decomposer.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Decomposer : MonoBehaviour
5 | {
6 | public virtual Goal Decompose (Goal goal)
7 | {
8 | return goal;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Decomposer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 20a6866b78a3ca143bd28470c26edcdd
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Evade.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Evade : Flee
5 | {
6 | public float maxPrediction;
7 | private GameObject targetAux;
8 | private Agent targetAgent;
9 |
10 | public override void Awake()
11 | {
12 | base.Awake();
13 | targetAgent = target.GetComponent();
14 | targetAux = target;
15 | target = new GameObject();
16 | }
17 |
18 | public override Steering GetSteering()
19 | {
20 | Vector3 direction = targetAux.transform.position - transform.position;
21 | float distance = direction.magnitude;
22 | float speed = agent.velocity.magnitude;
23 | float prediction;
24 | if (speed <= distance / maxPrediction)
25 | prediction = maxPrediction;
26 | else
27 | prediction = distance / speed;
28 | target.transform.position = targetAux.transform.position;
29 | target.transform.position += targetAgent.velocity * prediction;
30 | return base.GetSteering();
31 | }
32 |
33 | void OnDestroy ()
34 | {
35 | Destroy(targetAux);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Evade.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f7488afe89d1aad4ab0960ea79483375
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 700
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Face.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Face : Align {
5 |
6 | protected GameObject targetAux;
7 |
8 | public override void Awake()
9 | {
10 | base.Awake();
11 | targetAux = target;
12 | target = new GameObject();
13 | target.AddComponent();
14 | }
15 |
16 | public override Steering GetSteering()
17 | {
18 | Vector3 direction = targetAux.transform.position - transform.position;
19 | if (direction.magnitude > 0.0f)
20 | {
21 | float targetOrientation = Mathf.Atan2(direction.x, direction.z);
22 | targetOrientation *= Mathf.Rad2Deg;
23 | target.GetComponent().orientation = targetOrientation;
24 | }
25 | return base.GetSteering();
26 | }
27 |
28 | void OnDestroy ()
29 | {
30 | Destroy(target);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Face.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c4ca6187b927cca4da30b2d50d619de3
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 1100
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Flee.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | public class Flee : AgentBehaviour {
4 | public override Steering GetSteering()
5 | {
6 | Steering steering = new Steering();
7 | steering.linear = transform.position - target.transform.position;
8 | steering.linear.Normalize();
9 | steering.linear = steering.linear * agent.maxAccel;
10 | return steering;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Flee.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c5e7473981b3e014c8ace8f069351455
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 500
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Goal.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Goal {
5 |
6 | public bool isPosition;
7 | public bool isOrientation;
8 | public bool isVelocity;
9 | public bool isRotation;
10 |
11 | public float orientation;
12 | public float rotation;
13 | public Vector3 position;
14 | public Vector3 velocity;
15 |
16 | public Goal() {
17 | isPosition = false;
18 | isOrientation = false;
19 | isVelocity = false;
20 | isRotation = false;
21 | orientation = 0.0f;
22 | rotation = 0.0f;
23 | position = Vector3.zero;
24 | velocity = Vector3.zero;
25 | }
26 |
27 | public void UpdateChannels (Goal o) {
28 | if (o.isOrientation)
29 | orientation = o.orientation;
30 | if (o.isRotation)
31 | rotation = o.rotation;
32 | if (o.isPosition)
33 | position = o.position;
34 | if (o.isVelocity)
35 | velocity = o.velocity;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Goal.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: baef3940308a0ed4ea2a6b9a13357841
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Jump.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3ef1d3771318e514a8c7d58bf20f50b1
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/JumpLocation.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | public class JumpLocation : MonoBehaviour
4 | {
5 | public LandingLocation landingLocation;
6 |
7 | public void OnTriggerEnter(Collider other)
8 | {
9 | if (!other.gameObject.CompareTag("Agent"))
10 | return;
11 | Agent agent = other.GetComponent();
12 | Jump jump = other.GetComponent();
13 | if (agent == null || jump == null)
14 | return;
15 | Vector3 originPos = transform.position;
16 | Vector3 targetPos = landingLocation.transform.position;
17 | jump.Isolate(true);
18 | jump.jumpPoint = new JumpPoint(originPos, targetPos);
19 | jump.DoJump();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/JumpLocation.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e6411c37bdc0d384bb21774451b00609
3 | timeCreated: 1458055812
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/JumpPoint.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | public class JumpPoint
4 | {
5 | public Vector3 jumpLocation;
6 | public Vector3 landingLocation;
7 | //The change in position from jump to landing
8 | public Vector3 deltaPosition;
9 |
10 | public JumpPoint ()
11 | : this (Vector3.zero, Vector3.zero)
12 | {
13 | }
14 |
15 | public JumpPoint(Vector3 a, Vector3 b)
16 | {
17 | this.jumpLocation = a;
18 | this.landingLocation = b;
19 | this.deltaPosition = this.landingLocation - this.jumpLocation;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/JumpPoint.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b39198b37f415ef4586f743825fbd89d
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/LandingLocation.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | public class LandingLocation : MonoBehaviour
4 | {
5 | public void OnTriggerEnter(Collider other)
6 | {
7 | if (!other.gameObject.CompareTag("Agent"))
8 | return;
9 | Agent agent = other.GetComponent();
10 | Jump jump = other.GetComponent();
11 | if (agent == null || jump == null)
12 | return;
13 | jump.Isolate(false);
14 | jump.jumpPoint = null;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/LandingLocation.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ff5491222fb342c49ba93e7067d31221
3 | timeCreated: 1458055812
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Leave.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Leave : AgentBehaviour
5 | {
6 | public float escapeRadius;
7 | public float dangerRadius;
8 | public float timeToTarget = 0.1f;
9 |
10 | public override Steering GetSteering()
11 | {
12 | Steering steering = new Steering();
13 | Vector3 direction = transform.position - target.transform.position;
14 | float distance = direction.magnitude;
15 | if (distance > dangerRadius)
16 | return steering;
17 | float reduce;
18 | if (distance < escapeRadius)
19 | reduce = 0f;
20 | else
21 | reduce = distance / dangerRadius * agent.maxSpeed;
22 | float targetSpeed = agent.maxSpeed - reduce;
23 | Vector3 desiredVelocity = direction;
24 | desiredVelocity.Normalize();
25 | desiredVelocity *= targetSpeed;
26 | steering.linear = desiredVelocity - agent.velocity;
27 | steering.linear /= timeToTarget;
28 | if (steering.linear.magnitude > agent.maxAccel)
29 | {
30 | steering.linear.Normalize();
31 | steering.linear *= agent.maxAccel;
32 | }
33 | return steering;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Leave.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 215f9f29cde4f774884163703ded4334
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 900
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Path.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 057e6f47d72353042a36fd8b73375b67
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/PathFollower.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class PathFollower : Seek
5 | {
6 | public Path path;
7 | public float pathOffset = 0.0f;
8 | float currentParam;
9 |
10 | public override void Awake()
11 | {
12 | base.Awake();
13 | target = new GameObject();
14 | currentParam = 0f;
15 | }
16 |
17 | public override Steering GetSteering()
18 | {
19 | currentParam = path.GetParam(transform.position, currentParam);
20 | float targetParam = currentParam + pathOffset;
21 | target.transform.position = path.GetPosition(targetParam);
22 | // TODO
23 | // Change the approach in order to solve
24 | // Vector3 targetParam = currentParam + pathOffset;
25 | // target.transform.position = path.GetPosition(currentParam);
26 | return base.GetSteering();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/PathFollower.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 91eb830cdbe7681418e743db8ea9162a
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/PathSegment.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class PathSegment
5 | {
6 | public Vector3 a;
7 | public Vector3 b;
8 |
9 | public PathSegment () : this (Vector3.zero, Vector3.zero){}
10 |
11 | public PathSegment (Vector3 a, Vector3 b)
12 | {
13 | this.a = a;
14 | this.b = b;
15 | }
16 | }
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/PathSegment.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9850c15879c98614c94b64c171d16aa0
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Projectile.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1f5d9762f24d48342b1d02851ba2fe3d
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/ProjectileDirector.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class ProjectileDirector : MonoBehaviour {
5 |
6 | public GameObject projectileSimple;
7 | public float speed = 7.0f;
8 | public float shootDelay = 0.5f;
9 |
10 | public GameObject target;
11 | public float targetSpeed = 3.0f;
12 |
13 | Vector3 targetDirection;
14 | float shootTimer = 0.0f;
15 | Vector3 direction;
16 | Renderer myRenderer;
17 |
18 | void Start () {
19 | targetDirection = Vector3.right;
20 | myRenderer = GameObject.Find("Capsule").GetComponent();
21 | }
22 |
23 | void Update () {
24 | if (target.transform.position.x > 10.0f)
25 | targetDirection = Vector3.left;
26 | if (target.transform.position.x < -10.0f)
27 | targetDirection = Vector3.right;
28 | target.transform.Translate(targetDirection * targetSpeed * Time.deltaTime);
29 |
30 | shootTimer += Time.deltaTime;
31 | if (shootTimer >= shootDelay)
32 | {
33 | shootTimer -= shootDelay;
34 | Shoot();
35 | }
36 | }
37 |
38 | void Shoot () {
39 | Vector3 firePos = transform.position;
40 | firePos.y = myRenderer.bounds.max.y;
41 | Vector3 startPos = transform.position;
42 | Vector3 endPos = target.transform.position;
43 | Vector3 direction = Projectile.GetFireDirection(startPos, endPos, speed);
44 | GameObject projectile = Instantiate(projectileSimple, firePos, new Quaternion()) as GameObject;
45 | projectile.GetComponent().Set(firePos, direction, speed);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/ProjectileDirector.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 92c0c233fafb25443ae0674095f8d655
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/ProjectileDrag.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class ProjectileDrag : MonoBehaviour {
5 | private bool set = false;
6 | private Vector3 firePos;
7 | private Vector3 direction;
8 | private float speed;
9 | private float timeElapsed;
10 | private float drag;
11 | private Vector3 A;
12 | private Vector3 B;
13 | private Vector3 position;
14 |
15 | void Update ()
16 | {
17 | if (!set)
18 | return;
19 | timeElapsed += Time.deltaTime;
20 | transform.position = firePos + direction * speed * timeElapsed;
21 | transform.position += Physics.gravity * (timeElapsed * timeElapsed) / 2.0f;
22 | float exp_kt = Mathf.Exp(-(drag*timeElapsed));
23 | position = Physics.gravity * timeElapsed;
24 | position -= A * exp_kt;
25 | position /= drag;
26 | position += B;
27 | transform.position += position;
28 | // extra validation for cleaning the scene
29 | if (transform.position.y < -1.0f)
30 | Destroy(this.gameObject);// or set = false; and hide it
31 | }
32 |
33 | public void Set (Vector3 firePos, Vector3 direction, float speed, float drag)
34 | {
35 | this.firePos = firePos;
36 | this.direction = direction.normalized;
37 | this.speed = speed;
38 | this.drag = drag;
39 | timeElapsed = 0.0f;
40 | A = direction.normalized * speed;
41 | A -= Physics.gravity / drag;
42 | B = firePos - (A / drag);
43 | set = true;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/ProjectileDrag.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 89cfc1f908b408241af293f74d06b613
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/ProjectilePredictor.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class ProjectilePredictor : MonoBehaviour {
6 |
7 | public GameObject projectileTemplate;
8 | public GameObject projectilePredictor;
9 | public float predictionHeight = 0.0f;
10 | public float speed;
11 | public Vector3 direction;
12 | List projectiles;
13 | Renderer myRenderer;
14 | Projectile p;
15 | void Awake () {
16 | projectiles = new List();
17 | myRenderer = GameObject.Find("Capsule").GetComponent();
18 | }
19 |
20 | void Update () {
21 | if (projectiles.Count == 0)
22 | {
23 | Vector3 firePos = transform.position;
24 | firePos.y += this.myRenderer.bounds.size.y / 2.0f;
25 | direction = Random.insideUnitSphere;
26 | direction.y = Mathf.Abs(direction.y);
27 | speed = Random.Range(5.0f, 15.0f);
28 | GameObject p = Instantiate(projectileTemplate, firePos, new Quaternion()) as GameObject;
29 | p.GetComponent().Set(firePos, direction, speed);
30 | projectiles.Add(p);
31 | }
32 | else
33 | {
34 | p = projectiles[0].GetComponent();
35 | projectilePredictor.transform.position = p.GetLandingPos(predictionHeight);
36 | if (projectiles[0].transform.position.y < predictionHeight)
37 | {
38 | Destroy(projectiles[0]);
39 | projectiles.Clear();
40 | projectilePredictor.transform.position = Vector3.zero;
41 | p = null;
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/ProjectilePredictor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2a6e4ea321960b743b0a003e60cf2bb2
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/ProjectileShooter.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class ProjectileShooter : MonoBehaviour {
5 |
6 | public GameObject projectileSimple;
7 | public float speed;
8 | public Vector3 direction;
9 |
10 | void Update ()
11 | {
12 | if (Input.GetButtonDown("Fire1"))
13 | {
14 | Vector3 position = transform.position + Vector3.up * 2.0f;
15 | GameObject projectile;
16 | projectile = Instantiate(projectileSimple, position, new Quaternion()) as GameObject;
17 | Projectile p = projectile.GetComponent();
18 | p.Set(position, direction, speed);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/ProjectileShooter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fcdb7a10e49712b4ea92ae3f4f74f632
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Pursue.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Pursue : Seek
5 | {
6 | public float maxPrediction;
7 | private GameObject targetAux;
8 | private Agent targetAgent;
9 |
10 | public override void Awake()
11 | {
12 | base.Awake();
13 | targetAgent = target.GetComponent();
14 | targetAux = target;
15 | target = new GameObject();
16 | }
17 |
18 | public override Steering GetSteering()
19 | {
20 | Vector3 direction = targetAux.transform.position - transform.position;
21 | float distance = direction.magnitude;
22 | float speed = agent.velocity.magnitude;
23 | float prediction;
24 | if (speed <= distance / maxPrediction)
25 | prediction = maxPrediction;
26 | else
27 | prediction = distance / speed;
28 | target.transform.position = targetAux.transform.position;
29 | target.transform.position += targetAgent.velocity * prediction;
30 | return base.GetSteering();
31 | }
32 |
33 | void OnDestroy ()
34 | {
35 | Destroy(targetAux);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Pursue.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 80aa38682c59adc4d9e66077acb9713c
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 600
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Seek.cs:
--------------------------------------------------------------------------------
1 | public class Seek : AgentBehaviour
2 | {
3 | public override Steering GetSteering()
4 | {
5 | Steering steering = new Steering();
6 | steering.linear = target.transform.position - transform.position;
7 | steering.linear.Normalize();
8 | steering.linear = steering.linear * agent.maxAccel;
9 | return steering;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Seek.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a52ec8279fd73094aa81f4bd44c44c9a
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 400
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Steering.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | public class Steering
4 | {
5 | public float angular;
6 | public Vector3 linear;
7 | public Steering ()
8 | {
9 | angular = 0.0f;
10 | linear = new Vector3();
11 | }
12 | }
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Steering.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 06a58ef08e788dd44a166bf43219d6f1
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/SteeringPipeline.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class SteeringPipeline : Wander
6 | {
7 | public int constraintSteps = 3;
8 | Targeter[] targeters;
9 | Decomposer[] decomposers;
10 | Constraint[] constraints;
11 | Actuator actuator;
12 |
13 | void Start ()
14 | {
15 | targeters = GetComponents();
16 | decomposers = GetComponents();
17 | constraints = GetComponents();
18 | actuator = GetComponent();
19 | }
20 |
21 | public override Steering GetSteering()
22 | {
23 | Goal goal = new Goal();
24 | foreach (Targeter targeter in targeters)
25 | goal.UpdateChannels(targeter.GetGoal());
26 | foreach (Decomposer decomposer in decomposers)
27 | goal = decomposer.Decompose(goal);
28 | for (int i = 0; i < constraintSteps; i++)
29 | {
30 | Path path = actuator.GetPath(goal);
31 | foreach (Constraint constraint in constraints)
32 | {
33 | if (constraint.WillViolate(path))
34 | {
35 | goal = constraint.Suggest(path);
36 | break;
37 | }
38 | return actuator.GetOutput(path, goal);
39 | }
40 | }
41 | return base.GetSteering();
42 | }
43 | }
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/SteeringPipeline.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f61fee6edd29ab649b9d19d78e322f6d
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Targeter.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Targeter : MonoBehaviour
5 | {
6 | public virtual Goal GetGoal()
7 | {
8 | return new Goal();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Targeter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b03855806727b9a4294dd08fd830724c
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/VelocityMatch.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class VelocityMatch : AgentBehaviour
5 | {
6 | public float timeToTarget = 0.1f;
7 |
8 | public override void Awake()
9 | {
10 | base.Awake();
11 | }
12 |
13 | public override Steering GetSteering()
14 | {
15 | Steering steering = new Steering();
16 |
17 | steering.linear = target.GetComponent().velocity - agent.velocity;
18 |
19 | steering.linear /= timeToTarget;
20 |
21 | if (steering.linear.magnitude > agent.maxAccel)
22 | {
23 | steering.linear = steering.linear.normalized * agent.maxAccel;
24 | }
25 |
26 | steering.angular = 0f;
27 |
28 | return steering;
29 | }
30 |
31 | }
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/VelocityMatch.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e073695c83aa0b64f98c8a982eb35377
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Wander.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Wander : Face {
5 |
6 | public float offset;
7 | public float radius;
8 | public float rate;
9 |
10 | public override void Awake()
11 | {
12 | target = new GameObject();
13 | target.transform.position = transform.position;
14 | base.Awake();
15 | }
16 |
17 | public override Steering GetSteering()
18 | {
19 | Steering steering = new Steering();
20 | float wanderOrientation = Random.Range(-1.0f, 1.0f) * rate;
21 | float targetOrientation = wanderOrientation + agent.orientation;
22 | Vector3 orientationVec = OriToVec(agent.orientation);
23 | Vector3 targetPosition = (offset * orientationVec) + transform.position;
24 | targetPosition = targetPosition + (OriToVec(targetOrientation) * radius);
25 | targetAux.transform.position = targetPosition;
26 | steering = base.GetSteering();
27 | steering.linear = targetAux.transform.position - transform.position;
28 | steering.linear.Normalize();
29 | steering.linear *= agent.maxAccel;
30 | return steering;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch01Behaviours/Wander.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b78ebc94aed924045a3dc4efb7a1db50
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 1400
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 18ee08f80e469d04081bbb08f7cf1510
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/BinaryHeap.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a5991ce41b4a5b8419577f41e284338d
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/CustomNavMesh.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class CustomNavMesh : Graph
6 | {
7 | public override void Start()
8 | {
9 | instIdToId = new Dictionary();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/CustomNavMesh.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9204611ad67299844b66de1f9fe797a8
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/Edge.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | [System.Serializable]
4 | public class Edge : IComparable
5 | {
6 | public float cost;
7 | public Vertex vertex;
8 |
9 | public Edge(Vertex vertex = null, float cost = 1f)
10 | {
11 | this.vertex = vertex;
12 | this.cost = cost;
13 | }
14 |
15 | public int CompareTo(Edge other)
16 | {
17 | float result = cost - other.cost;
18 | int idA = vertex.GetInstanceID();
19 | int idB = other.vertex.GetInstanceID();
20 | if (idA == idB)
21 | return 0;
22 | return (int)result;
23 | }
24 |
25 | public bool Equals(Edge other)
26 | {
27 | return (other.vertex.id == this.vertex.id);
28 | }
29 |
30 | public override bool Equals(object obj)
31 | {
32 | Edge other = (Edge)obj;
33 | return (other.vertex.id == this.vertex.id);
34 | }
35 |
36 | public override int GetHashCode()
37 | {
38 | return this.vertex.GetHashCode();
39 | }
40 | }
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/Edge.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a98cac103c5c8c74f9406da359a48f24
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 47667c42f353ec7448778fe27ea346bd
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/Editor/CustomNavMeshEditor.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEditor;
3 | using System.Collections;
4 |
5 | [CustomEditor(typeof(CustomNavMesh))]
6 | public class CustomNavMeshEditor : Editor
7 | {
8 |
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/Editor/CustomNavMeshEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6aff3995561e42549bf4c504e96a4bda
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/Editor/CustomNavMeshWindow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d9f4e23b7748e3446b3908013e44401d
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/Graph.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 79647f8f5bb9c2b41a22b1432088f34d
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/GraphDirichlet.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ace55bf8a6553a948bc31b3fb533582c
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/GraphGrid.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 92c7ba813361eb440bd89eec0ad19087
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/GraphVisibility.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections.Generic;
3 |
4 | public class GraphVisibility : Graph
5 | {
6 |
7 | public override void Load()
8 | {
9 | Vertex[] verts = GameObject.FindObjectsOfType();
10 | vertices = new List(verts);
11 | for (int i = 0; i < vertices.Count; i++)
12 | {
13 | VertexVisibility vv = vertices[i] as VertexVisibility;
14 | vv.id = i;
15 | vv.FindNeighbours(vertices);
16 | }
17 | }
18 |
19 | public override Vertex GetNearestVertex(Vector3 position)
20 | {
21 | Vertex vertex = null;
22 | float dist = Mathf.Infinity;
23 | float distNear = dist;
24 | Vector3 posVertex = Vector3.zero;
25 | for (int i = 0; i < vertices.Count; i++)
26 | {
27 | posVertex = vertices[i].transform.position;
28 | dist = Vector3.Distance(position, posVertex);
29 | if (dist < distNear)
30 | {
31 | distNear = dist;
32 | vertex = vertices[i];
33 | }
34 | }
35 | return vertex;
36 | }
37 |
38 | public override Vertex[] GetNeighbours(Vertex v)
39 | {
40 | List edges = v.neighbours;
41 | Vertex[] ns = new Vertex[edges.Count];
42 | int i;
43 | for (i = 0; i < edges.Count; i++)
44 | {
45 | ns[i] = edges[i].vertex;
46 | }
47 | return ns;
48 | }
49 |
50 | public override Edge[] GetEdges(Vertex v)
51 | {
52 | return vertices[v.id].neighbours.ToArray();
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/GraphVisibility.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7d19725a31798d345a72290e5fcbfd1c
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/Vertex.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections.Generic;
3 | [System.Serializable]
4 | public class Vertex : MonoBehaviour
5 | {
6 | public int id;
7 | public List neighbours;
8 | [HideInInspector]
9 | public Vertex prev;
10 | }
11 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/Vertex.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1269c6d63044faa46be298e0bdaa8850
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/VertexDirichlet.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | public class VertexDirichlet : Vertex
4 | {
5 | public void OnTriggerEnter(Collider col)
6 | {
7 | string objName = col.gameObject.name;
8 | if (objName.Equals("Agent") || objName.Equals("Player"))
9 | {
10 | VertexReport report = new VertexReport(id, col.gameObject);
11 | SendMessageUpwards("AddLocation", report);
12 | }
13 | }
14 |
15 | public void OnTriggerExit(Collider col)
16 | {
17 | string objName = col.gameObject.name;
18 | if (objName.Equals("Agent") || objName.Equals("Player"))
19 | {
20 | VertexReport report = new VertexReport(id, col.gameObject);
21 | SendMessageUpwards("RemoveLocation", report);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/VertexDirichlet.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: db96876f06de7f642bf90e0b91d7ea31
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/VertexVisibility.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections.Generic;
3 |
4 | public class VertexVisibility : Vertex
5 | {
6 |
7 | void Awake()
8 | {
9 | neighbours = new List();
10 | }
11 |
12 | public void FindNeighbours(List vertices)
13 | {
14 | Collider c = gameObject.GetComponent();
15 | c.enabled = false;
16 | Vector3 direction = Vector3.zero;
17 | Vector3 origin = transform.position;
18 | Vector3 target = Vector3.zero;
19 | RaycastHit[] hits;
20 | Ray ray;
21 | float distance = 0f;
22 | for (int i = 0; i < vertices.Count; i++)
23 | {
24 | if (vertices[i] == this)
25 | continue;
26 | target = vertices[i].transform.position;
27 | direction = target - origin;
28 | distance = direction.magnitude;
29 | ray = new Ray(origin, direction);
30 | hits = Physics.RaycastAll(ray, distance);
31 | if (hits.Length == 1)
32 | {
33 | if (hits[0].collider.gameObject.tag.Equals("Vertex"))
34 | {
35 | Edge e = new Edge();
36 | e.cost = distance;
37 | GameObject go = hits[0].collider.gameObject;
38 | Vertex v = go.GetComponent();
39 | if (v != vertices[i])
40 | continue;
41 | e.vertex = v;
42 | neighbours.Add(e);
43 | }
44 | }
45 | }
46 | c.enabled = true;
47 | }
48 |
49 | ///
50 | /// Not in book. This is for testing purposes only.
51 | ///
52 | public void OnDrawGizmos()
53 | {
54 | Gizmos.color = Color.magenta;
55 | Vector3 originPos, targetPos;
56 | originPos = transform.position;
57 | foreach (Edge e in neighbours)
58 | {
59 | targetPos = e.vertex.transform.position;
60 | Gizmos.DrawLine(originPos, targetPos);
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch02Navigation/VertexVisibility.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8e7771b9448766440aa0e97edd68fe8c
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 31aead14fc80d1248922146c834673ee
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Action.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Action : DecisionTreeNode
5 | {
6 | public bool activated = false;
7 |
8 | public override DecisionTreeNode MakeDecision()
9 | {
10 | return this;
11 | }
12 |
13 | public virtual void LateUpdate()
14 | {
15 | if (!activated)
16 | return;
17 | // Implement your
18 | // behaviours here
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Action.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3130a359820f58a4da05e0f3a6acad17
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ActionBT.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class ActionBT : Task
5 | {
6 | public override IEnumerator Run()
7 | {
8 | isFinished = false;
9 | // implement your behaviour here
10 | //---------
11 | return base.Run();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ActionBT.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2ef72e37d91217c459187f562c6f9fa3
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ActionChooser.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class ActionChooser : MonoBehaviour
5 | {
6 | public ActionGOB Choose(ActionGOB[] actions, GoalGOB[] goals)
7 | {
8 | ActionGOB bestAction;
9 | bestAction = actions[0];
10 | float bestValue = CalculateDiscontentment(actions[0], goals);
11 | float value;
12 | foreach (ActionGOB action in actions)
13 | {
14 | value = CalculateDiscontentment(action, goals);
15 | if (value < bestValue)
16 | {
17 | bestValue = value;
18 | bestAction = action;
19 | }
20 | }
21 | return bestAction;
22 | }
23 |
24 | public float CalculateDiscontentment(ActionGOB action, GoalGOB[] goals)
25 | {
26 | float discontentment = 0;
27 | foreach (GoalGOB goal in goals)
28 | {
29 | float newValue = goal.value + action.GetGoalChange(goal);
30 | newValue += action.GetDuration() * goal.GetChange();
31 | discontentment += goal.GetDiscontentment(newValue);
32 | }
33 | return discontentment;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ActionChooser.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 994695d6065e6f74bb430947ef008958
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ActionGOB.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class ActionGOB : MonoBehaviour
5 | {
6 | public virtual float GetGoalChange(GoalGOB goal)
7 | {
8 | return 0f;
9 | }
10 |
11 | public virtual float GetDuration()
12 | {
13 | return 0f;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ActionGOB.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cde04477546b4e14b974335ce3db6e25
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ActionState.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class ActionState : DecisionTreeNode
5 | {
6 | public State state;
7 |
8 | public override DecisionTreeNode MakeDecision()
9 | {
10 | return this;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ActionState.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 751e6e2edafee974d95c5fa9ac004341
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Condition.cs:
--------------------------------------------------------------------------------
1 | public class Condition
2 | {
3 | public virtual bool Test()
4 | {
5 | return false;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Condition.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 190f6a304e9e53041b3af7ae66a17b22
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ConditionAnd.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class ConditionAnd : Condition
5 | {
6 | public Condition conditionA;
7 | public Condition conditionB;
8 |
9 | public override bool Test()
10 | {
11 | if (conditionA.Test() || conditionB.Test())
12 | return true;
13 | return false;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ConditionAnd.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d421ebd512f3f714f82871c851f5ccf8
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ConditionBT.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class ConditionBT : Task
5 | {
6 | public override IEnumerator Run()
7 | {
8 | isFinished = false;
9 | bool r = false;
10 | // implement your behaviour here
11 | // define result (r) whether true or false
12 | //---------
13 | SetResult(r);
14 | yield break;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ConditionBT.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8310cf4e860ea5343839c7aab0cfacea
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ConditionFloat.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class ConditionFloat : Condition
5 | {
6 | public float valueMin;
7 | public float valueMax;
8 | public float valueTest;
9 |
10 | public override bool Test()
11 | {
12 | if (valueMax >= valueTest && valueTest >= valueMin)
13 | return true;
14 | return false;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ConditionFloat.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 401e4377206b3404496032a1780aaf0b
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ConditionTargetClose.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | public class ConditionTargetClose : Condition
4 | {
5 | public GameObject origin;
6 | public GameObject target;
7 | public float minDistance;
8 |
9 | public override bool Test()
10 | {
11 | if (origin == null || target == null)
12 | return false;
13 | Vector3 originPos = origin.transform.position;
14 | Vector3 targetPos = target.transform.position;
15 | if (Vector3.Distance(originPos, targetPos) <= minDistance)
16 | return true;
17 | return false;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ConditionTargetClose.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e2859d1261ae74040b55492fc500a6fc
3 | timeCreated: 1458404148
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ConditionTargetFar.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | public class ConditionTargetFar : Condition
4 | {
5 | public GameObject origin;
6 | public GameObject target;
7 | public float maxDistance;
8 |
9 | public override bool Test()
10 | {
11 | if (origin == null || target == null)
12 | return false;
13 | Vector3 originPos = origin.transform.position;
14 | Vector3 targetPos = target.transform.position;
15 | if (Vector3.Distance(originPos, targetPos) > maxDistance)
16 | return true;
17 | return false;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/ConditionTargetFar.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: becf1ba86f824244b877c1d2c64af795
3 | timeCreated: 1458477030
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Decision.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Decision : DecisionTreeNode
5 | {
6 | public Action nodeTrue;
7 | public Action nodeFalse;
8 |
9 | public virtual Action GetBranch()
10 | {
11 | return null;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Decision.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9a5d6426b6b9ed543aa1b98ba30687cb
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/DecisionBool.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class DecisionBool : Decision
5 | {
6 |
7 | public bool valueDecision;
8 | public bool valueTest;
9 |
10 | public override Action GetBranch()
11 | {
12 | if (valueTest == valueDecision)
13 | return nodeTrue;
14 | return nodeFalse;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/DecisionBool.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f41e0bd2bdc60004a80f1f20f75065df
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/DecisionFloat.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class DecisionFloat : Decision
5 | {
6 | public float valueMin;
7 | public float valueMax;
8 | public float valueTest;
9 |
10 | public override Action GetBranch()
11 | {
12 | if (valueMax >= valueTest && valueTest >= valueMin)
13 | return nodeTrue;
14 | return nodeFalse;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/DecisionFloat.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bbd79d4d70d925843a8c7df4a50b2448
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/DecisionTree.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class DecisionTree : DecisionTreeNode
5 | {
6 | public DecisionTreeNode root;
7 | private Action actionNew;
8 | private Action actionOld;
9 |
10 | void Update()
11 | {
12 | actionNew.activated = false;
13 | actionOld = actionNew;
14 | actionNew = root.MakeDecision() as Action;
15 | if (actionNew == null)
16 | actionNew = actionOld;
17 | actionNew.activated = true;
18 | }
19 |
20 | public override DecisionTreeNode MakeDecision()
21 | {
22 | return root.MakeDecision();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/DecisionTree.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e726187c613791b41a97f07cc5647684
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/DecisionTreeNode.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class DecisionTreeNode : MonoBehaviour
5 | {
6 |
7 | public virtual DecisionTreeNode MakeDecision()
8 | {
9 | return null;
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/DecisionTreeNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 456d2cae231576741b3b7472d36a9a45
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/FuzzyDecisionMaker.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class FuzzyDecisionMaker : MonoBehaviour
6 | {
7 | public Dictionary MakeDecision(object[] inputs, MembershipFunction[][] mfList, FuzzyRule[] rules)
8 | {
9 | Dictionary inputDOM = new Dictionary();
10 | Dictionary outputDOM = new Dictionary();
11 | MembershipFunction memberFunc;
12 |
13 | foreach (object input in inputs)
14 | {
15 | int r, c;
16 | for (r = 0; r < mfList.Length; r++)
17 | {
18 | for (c = 0; c < mfList[r].Length; c++)
19 | {
20 | memberFunc = mfList[r][c];
21 | int mfId = memberFunc.stateId;
22 | float dom = memberFunc.GetDOM(input);
23 | if (!inputDOM.ContainsKey(mfId))
24 | {
25 | inputDOM.Add(mfId, dom);
26 | outputDOM.Add(mfId, 0f);
27 | }
28 | else
29 | inputDOM[mfId] = dom;
30 | }
31 | }
32 | }
33 |
34 | foreach (FuzzyRule rule in rules)
35 | {
36 | int outputId = rule.conclusionStateId;
37 | float best = outputDOM[outputId];
38 | float min = 1f;
39 | foreach (int state in rule.stateIds)
40 | {
41 | float dom = inputDOM[state];
42 | if (dom < best)
43 | continue;
44 | if (dom < min)
45 | min = dom;
46 | }
47 | outputDOM[outputId] = min;
48 | }
49 | return outputDOM;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/FuzzyDecisionMaker.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bab435d070ec5744f96908b5dfbf2bca
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/FuzzyRule.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 |
4 | public class FuzzyRule
5 | {
6 | public List stateIds;
7 | public int conclusionStateId;
8 | }
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/FuzzyRule.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 524164c5f77b324439e199aa51551f75
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/GoalGOB.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class GoalGOB
5 | {
6 | public string name;
7 | public float value;
8 | public float change;
9 |
10 | public virtual float GetDiscontentment(float newValue)
11 | {
12 | return newValue * newValue;
13 | }
14 |
15 | public virtual float GetChange()
16 | {
17 | return 0f;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/GoalGOB.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: beed679a3b2da544eb8652a54a5b5278
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/MFEnraged.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System;
3 | using System.Collections;
4 |
5 | public class MFEnraged : MembershipFunction
6 | {
7 | public override float GetDOM(object input)
8 | {
9 | if ((int)input <= 30)
10 | return 1f;
11 | return 0f;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/MFEnraged.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 72864c27116b5754d94a2c022e428dc5
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/MarkovStateMachine.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class MarkovStateMachine : MonoBehaviour
6 | {
7 | public Vector4 state;
8 | public Matrix4x4 defaultMatrix;
9 | public float timeReset;
10 | public float timeCurrent;
11 | public List transitions;
12 | private MonoBehaviour action;
13 |
14 | void Start()
15 | {
16 | timeCurrent = timeReset;
17 | }
18 |
19 | void Update()
20 | {
21 | if (action != null)
22 | action.enabled = false;
23 |
24 | MarkovTransition triggeredTransition;
25 | triggeredTransition = null;
26 |
27 | foreach (MarkovTransition mt in transitions)
28 | {
29 | if (mt.IsTriggered())
30 | {
31 | triggeredTransition = mt;
32 | break;
33 | }
34 | }
35 | if (triggeredTransition != null)
36 | {
37 | timeCurrent = timeReset;
38 | Matrix4x4 matrix = triggeredTransition.matrix;
39 | state = matrix * state;
40 | action = triggeredTransition.action;
41 | }
42 | else
43 | {
44 | timeCurrent -= Time.deltaTime;
45 | if (timeCurrent <= 0f)
46 | {
47 | state = defaultMatrix * state;
48 | timeCurrent = timeReset;
49 | action = null;
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/MarkovStateMachine.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ebeadda780188fe48bae4d1aa2b2e2f3
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/MarkovTransition.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class MarkovTransition : MonoBehaviour
5 | {
6 | public Matrix4x4 matrix;
7 | public MonoBehaviour action;
8 |
9 | public virtual bool IsTriggered()
10 | {
11 | // implementation details here
12 | return false;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/MarkovTransition.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3b40dd59066386a4d8062eff5421a705
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/MembershipFunction.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class MembershipFunction : MonoBehaviour
5 | {
6 | public int stateId;
7 | public virtual float GetDOM(object input)
8 | {
9 | return 0f;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/MembershipFunction.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 41782d926974bff4b821bdc7cc340446
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Selector.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Selector : Task
5 | {
6 | public override void SetResult(bool r)
7 | {
8 | if (r == true)
9 | isFinished = true;
10 | }
11 |
12 | public override IEnumerator RunTask()
13 | {
14 | foreach (Task t in children)
15 | yield return StartCoroutine(t.RunTask());
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Selector.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 464345c332d53dc468773a644747f68d
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Sequence.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Sequence : Task
5 | {
6 | public override void SetResult(bool r)
7 | {
8 | if (r == true)
9 | isFinished = true;
10 | }
11 |
12 | public override IEnumerator RunTask()
13 | {
14 | foreach (Task t in children)
15 | yield return StartCoroutine(t.RunTask());
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Sequence.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b4942a8b90116da4195c020e66d4010b
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/State.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections.Generic;
3 |
4 | public class State : MonoBehaviour
5 | {
6 | public List transitions;
7 |
8 | public virtual void Awake()
9 | {
10 | transitions = new List();
11 | // TO-DO
12 | // setup your transitions here
13 | }
14 |
15 | public virtual void Update()
16 | {
17 | // TO-DO
18 | // develop behaviour here
19 | }
20 |
21 | public virtual void OnEnable()
22 | {
23 | // TO-DO
24 | // develop initialization here
25 | }
26 |
27 | public virtual void OnDisable()
28 | {
29 | // TO-DO
30 | // develop finalization here
31 | }
32 |
33 |
34 | public void LateUpdate()
35 | {
36 | foreach (Transition t in transitions)
37 | {
38 | if (t.condition.Test())
39 | {
40 | State target;
41 | if (t.GetType().Equals(typeof(TransitionDecision)))
42 | {
43 | TransitionDecision td = t as TransitionDecision;
44 | target = td.GetState();
45 | }
46 | else
47 | target = t.target;
48 | target.enabled = true;
49 | this.enabled = false;
50 | return;
51 | }
52 | }
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/State.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d237f9f9f85fa9f42b92ea3715e2d9a9
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/StateHighLevel.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class StateHighLevel : State
6 | {
7 | public List states;
8 | public State stateInitial;
9 | protected State stateCurrent;
10 |
11 | public override void OnEnable()
12 | {
13 | if (stateCurrent == null)
14 | stateCurrent = stateInitial;
15 | stateCurrent.enabled = true;
16 | }
17 |
18 | public override void OnDisable()
19 | {
20 | base.OnDisable();
21 | stateCurrent.enabled = false;
22 | foreach (State s in states)
23 | {
24 | s.enabled = false;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/StateHighLevel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b492215e18f2f8649ad9bb19c9e8a163
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/StateIdle.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | public class StateIdle : State
4 | {
5 | public override void Awake()
6 | {
7 | base.Awake();
8 | ConditionTargetClose ctc = new ConditionTargetClose();
9 | ctc.origin = this.gameObject;
10 | ctc.target = GameObject.FindGameObjectWithTag("Player");
11 | ctc.minDistance = 3f;
12 | State st = GetComponent();
13 | Transition transition = new Transition();
14 | transition.condition = ctc;
15 | transition.target = st;
16 | transitions.Add(transition);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/StateIdle.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 07f849fe6c12e8e41a0e3af4fb358a19
3 | timeCreated: 1458404148
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/StateSeek.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | public class StateSeek : State
4 | {
5 | public float speed;
6 | public GameObject targetToFollow;
7 |
8 | public override void Awake()
9 | {
10 | base.Awake();
11 | ConditionTargetFar ctf = new ConditionTargetFar();
12 | ctf.origin = this.gameObject;
13 | ctf.target = targetToFollow;
14 | ctf.maxDistance = 7f;
15 | State st = GetComponent();
16 | Transition transition = new Transition();
17 | transition.condition = ctf;
18 | transition.target = st;
19 | transitions.Add(transition);
20 | }
21 |
22 | public override void Update()
23 | {
24 | if (targetToFollow == null)
25 | return;
26 | Vector3 direction = targetToFollow.transform.position - transform.position;
27 | direction.Normalize();
28 | transform.Translate(direction * speed * Time.deltaTime, Space.World);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/StateSeek.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0d08bdf929bf98f47855cf5920983e28
3 | timeCreated: 1458475570
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Task.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class Task : MonoBehaviour
6 | {
7 | public List children;
8 | protected bool result = false;
9 | protected bool isFinished = false;
10 |
11 | public virtual void SetResult(bool r)
12 | {
13 | result = r;
14 | isFinished = true;
15 | }
16 |
17 | public IEnumerator PrintNumber(int n)
18 | {
19 | Debug.Log(n);
20 | yield break;
21 | }
22 |
23 | public virtual IEnumerator Run()
24 | {
25 | SetResult(true);
26 | yield break;
27 | }
28 |
29 | public virtual IEnumerator RunTask()
30 | {
31 | yield return StartCoroutine(Run());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Task.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e33ac002a53bf3f47ba16991239c2d9a
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Transition.cs:
--------------------------------------------------------------------------------
1 | public class Transition
2 | {
3 | public Condition condition;
4 | public State target;
5 | }
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/Transition.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 336a73a671a3dce4baf5f6ae3413d496
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/TransitionDecision.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class TransitionDecision : Transition
5 | {
6 | public DecisionTreeNode root;
7 |
8 | public State GetState()
9 | {
10 | ActionState action;
11 | action = root.MakeDecision() as ActionState;
12 | return action.state;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch03DecisionMaking/TransitionDecision.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 506de056f5a54d94fa6f1eb29a512615
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bb53fc056982db14686d1d96f7e12aae
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Attack.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Attack : MonoBehaviour
5 | {
6 | public int weight;
7 |
8 | public virtual IEnumerator Execute()
9 | {
10 | // your attack behaviour here
11 | yield break;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Attack.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9ec98761e1e256d40b698bdb366dc903
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Character.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Character : MonoBehaviour
5 | {
6 | public Location location;
7 |
8 | public void SetTarget (Location location)
9 | {
10 | this.location = location;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Character.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cae0d2e43cdd3bd4697ee65abf806ae7
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Enemy.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Enemy : MonoBehaviour
5 | {
6 | public StageManager stageManager;
7 | public int slotWeight;
8 | [HideInInspector]
9 | public int circleId = -1;
10 | [HideInInspector]
11 | public bool isAssigned;
12 | [HideInInspector]
13 | public Attack[] attackList;
14 |
15 | void Start()
16 | {
17 | attackList = gameObject.GetComponents();
18 | }
19 |
20 | public void SetCircle(GameObject circleObj = null)
21 | {
22 | int id = -1;
23 | if (circleObj == null)
24 | {
25 | Vector3 position = transform.position;
26 | id = stageManager.GetClosestCircle(position);
27 | }
28 | else
29 | {
30 | FightingCircle fc;
31 | fc = circleObj.GetComponent();
32 | if (fc != null)
33 | id = fc.gameObject.GetInstanceID();
34 | }
35 | circleId = id;
36 | }
37 |
38 | public bool RequestSlot()
39 | {
40 | isAssigned = stageManager.GrantSlot(circleId, this);
41 | return isAssigned;
42 | }
43 |
44 | public void ReleaseSlot()
45 | {
46 | stageManager.ReleaseSlot(circleId, this);
47 | isAssigned = false;
48 | circleId = -1;
49 | }
50 |
51 | public bool RequestAttack(int id)
52 | {
53 | return stageManager.GrantAttack(circleId, attackList[id]);
54 | }
55 |
56 | public virtual IEnumerator Attack()
57 | {
58 | yield break;
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Enemy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 01bff3e4d456f174497c204c6859fa14
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/FightingCircle.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5b255363e0ec4d84688f584889dad6a8
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/FormationManager.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class FormationManager : MonoBehaviour
6 | {
7 | public FormationPattern pattern;
8 | private List slotAssignments;
9 | private Location driftOffset;
10 |
11 | void Awake()
12 | {
13 | slotAssignments = new List();
14 | }
15 |
16 | public void UpdateSlotAssignments()
17 | {
18 | for (int i = 0; i < slotAssignments.Count; i++)
19 | {
20 | slotAssignments[i].slotIndex = i;
21 | }
22 | driftOffset = pattern.GetDriftOffset(slotAssignments);
23 | }
24 |
25 | public bool AddCharacter(GameObject character)
26 | {
27 | int occupiedSlots = slotAssignments.Count;
28 | if (!pattern.SupportsSlots(occupiedSlots + 1))
29 | return false;
30 | SlotAssignment sa = new SlotAssignment();
31 | sa.character = character;
32 | slotAssignments.Add(sa);
33 | UpdateSlotAssignments();
34 | return true;
35 | }
36 |
37 | public void RemoveCharacter(GameObject agent)
38 | {
39 | int index = slotAssignments.FindIndex(x => x.character.Equals(agent));
40 | slotAssignments.RemoveAt(index);
41 | UpdateSlotAssignments();
42 | }
43 |
44 | public void UpdateSlots()
45 | {
46 | GameObject leader = pattern.leader;
47 | Vector3 anchor = leader.transform.position;
48 | Vector3 slotPos;
49 | Quaternion rotation;
50 | rotation = leader.transform.rotation;
51 | foreach (SlotAssignment sa in slotAssignments)
52 | {
53 | Vector3 relPos;
54 | slotPos = pattern.GetSlotLocation(sa.slotIndex);
55 | relPos = anchor;
56 | relPos += leader.transform.TransformDirection(slotPos);
57 | Location charDrift = new Location(relPos, rotation);
58 | charDrift.position += driftOffset.position;
59 | charDrift.rotation *= driftOffset.rotation;
60 | Character character = sa.character.GetComponent();
61 | character.SetTarget(charDrift);
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/FormationManager.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f0e88f5781f106541a451f72bcad748e
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/FormationPattern.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class FormationPattern: MonoBehaviour
6 | {
7 | public int numOfSlots;
8 | public GameObject leader;
9 |
10 | void Start()
11 | {
12 | if (leader == null)
13 | leader = transform.gameObject;
14 | }
15 |
16 | public virtual Vector3 GetSlotLocation(int slotIndex)
17 | {
18 | return Vector3.zero;
19 | }
20 |
21 | public bool SupportsSlots(int slotCount)
22 | {
23 | return slotCount <= numOfSlots;
24 | }
25 |
26 | public virtual Location GetDriftOffset(List slotAssignments)
27 | {
28 | Location location = new Location();
29 | location.position = leader.transform.position;
30 | location.rotation = leader.transform.rotation;
31 | return location;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/FormationPattern.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d390f453f4e92a24c986e42e23d9e23c
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Guild.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System;
3 | using System.Collections;
4 |
5 | public class Guild : MonoBehaviour
6 | {
7 | public string guildName;
8 | public int maxStrength;
9 | public GameObject baseObject;
10 | [HideInInspector]
11 | public int strenght;
12 |
13 | public virtual void Awake()
14 | {
15 | strenght = maxStrength;
16 | }
17 |
18 | public virtual float GetDropOff(float distance)
19 | {
20 | // simple
21 | //return strength;
22 | // more elaborate
23 | float d = Mathf.Pow(1 + distance, 2f);
24 | return strenght / d;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Guild.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7b3bb1c4e268e184ba2d94f74a0a6cdf
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/GuildRecord.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System;
4 |
5 | public struct GuildRecord : IComparable
6 | {
7 | public Vertex location;
8 | public float strength;
9 | public Guild guild;
10 |
11 | public override bool Equals(object obj)
12 | {
13 | GuildRecord other = (GuildRecord)obj;
14 | return location == other.location;
15 | }
16 |
17 | public bool Equals(GuildRecord o)
18 | {
19 | return location == o.location;
20 | }
21 |
22 | public override int GetHashCode()
23 | {
24 | return base.GetHashCode();
25 | }
26 |
27 | public int CompareTo(GuildRecord other)
28 | {
29 | if (location == other.location)
30 | return 0;
31 | return (int)(other.strength - strength);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/GuildRecord.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b635a44fafa776f4086b1a32fbf34d61
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/InfluenceMap.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d4854f7861302104b9bdcd70c1124020
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Location.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Location
5 | {
6 | public Vector3 position;
7 | public Quaternion rotation;
8 |
9 | public Location ()
10 | {
11 | position = Vector3.zero;
12 | rotation = Quaternion.identity;
13 | }
14 |
15 | public Location(Vector3 position, Quaternion rotation)
16 | {
17 | this.position = position;
18 | this.rotation = rotation;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Location.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 72b22f805fe8117438c849c44c84fddf
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Lurker.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class Lurker : MonoBehaviour
6 | {
7 | [HideInInspector]
8 | public List path;
9 |
10 | void Awake()
11 | {
12 | if (ReferenceEquals(path, null))
13 | path = new List();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Lurker.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b04cb1e73da127746974e79a16cf876f
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/SlotAssignment.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class SlotAssignment
5 | {
6 | public int slotIndex;
7 | public GameObject character;
8 |
9 | public SlotAssignment()
10 | {
11 | slotIndex = -1;
12 | character = null;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/SlotAssignment.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6bdf63fffb4c2904ead7a272c92ad13b
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/StageManager.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4e6e5a1606d8f6f4b9f589cb75389f83
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Unit.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public enum Faction
5 | {
6 | BLUE, RED
7 | }
8 |
9 | public class Unit : MonoBehaviour
10 | {
11 | public Faction faction;
12 | public int radius = 1;
13 | public float influence = 1f;
14 |
15 | public virtual float GetDropOff(int locationDistance)
16 | {
17 | // simple
18 | //return influence;
19 | // more elaborate
20 | float d = influence / radius * locationDistance;
21 | return influence - d;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Unit.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3a9461c9f14e9e449b54c57a452a23c5
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/VertexInfluence.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class VertexInfluence : Vertex
6 | {
7 | public Faction faction;
8 | public float value = 0f;
9 |
10 | // map flooding
11 | public Guild guild;
12 |
13 | public bool SetValue(Faction f, float v)
14 | {
15 | bool isUpdated = false;
16 | if (v > value)
17 | {
18 | value = v;
19 | faction = f;
20 | isUpdated = true;
21 | }
22 | return isUpdated;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/VertexInfluence.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 08d57d148b702f34ba23ec7c3798b5b4
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch04TacticsCoordination/Waypoint.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b869f37437ced6b4c9995591e4f1646e
3 | MonoImporter:
4 | serializedVersion: 2
5 | defaultReferences: []
6 | executionOrder: 0
7 | icon: {instanceID: 0}
8 | userData:
9 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 08799d5131eb7744c8fa771800eb1173
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/AgentAwared.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class AgentAwared : MonoBehaviour
6 | {
7 | protected Interest interest;
8 |
9 | public bool IsRelevant(Interest i)
10 | {
11 | int oldValue = (int)interest.priority;
12 | int newValue = (int)i.priority;
13 | if (newValue <= oldValue)
14 | return false;
15 | return true;
16 | }
17 |
18 | public void Notice(Interest i)
19 | {
20 | StopCoroutine(Investigate());
21 | interest = i;
22 | StartCoroutine(Investigate());
23 | }
24 |
25 | public virtual IEnumerator Investigate()
26 | {
27 | // TODO
28 | // develop your implementation
29 | yield break;
30 | }
31 |
32 | public virtual IEnumerator Lead()
33 | {
34 | // TODO
35 | // develop your implementation
36 | yield break;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/AgentAwared.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d810732ee03d46f469f2c1ea7c799b51
3 | timeCreated: 1427069983
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/EmitterGraph.cs:
--------------------------------------------------------------------------------
1 | //using UnityEngine;
2 | //using System.Collections;
3 | //using System.Collections.Generic;
4 |
5 | //public class EmitterGraph : MonoBehaviour
6 | //{
7 | // public int soundIntensity;
8 | // public Graph soundGraph;
9 | // public GameObject emitterObj;
10 |
11 | // public void Start()
12 | // {
13 | // if (emitterObj == null)
14 | // emitterObj = gameObject;
15 | // }
16 |
17 | // public int[] Emit()
18 | // {
19 | // List nodeIds = new List();
20 | // Queue queue = new Queue();
21 | // List neighbours;
22 | // int size = soundGraph.GetSize();
23 | // bool[] visited = new bool[size];
24 | // int intensity = soundIntensity;
25 | // int src = soundGraph.GetNearestVertex(emitterObj);
26 | // nodeIds.Add(src);
27 | // queue.Enqueue(src);
28 | // while (queue.Count != 0)
29 | // {
30 | // if (intensity == 0)
31 | // break;
32 | // int v = queue.Dequeue();
33 | // neighbours = soundGraph.GetNeighbours(v);
34 | // foreach (int n in neighbours)
35 | // {
36 | // if (visited[n])
37 | // continue;
38 | // queue.Enqueue(n);
39 | // nodeIds.Add(n);
40 | // }
41 | // intensity--;
42 | // }
43 | // return nodeIds.ToArray();
44 | // }
45 | //}
46 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/EmitterGraph.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ee4c4271f5e58404f91851d7086e5913
3 | timeCreated: 1426695174
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/Interest.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public struct Interest
5 | {
6 | public InterestSense sense;
7 | public InterestPriority priority;
8 | public Vector3 position;
9 |
10 | public Interest(
11 | InterestSense sense,
12 | InterestPriority priority,
13 | Vector3 position)
14 | {
15 | this.sense = sense;
16 | this.priority = priority;
17 | this.position = position;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/Interest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 60f7a6e923499af41a7f064661eb1551
3 | timeCreated: 1427069983
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/InterestSource.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public enum InterestSense
6 | {
7 | SOUND,
8 | SIGHT
9 | };
10 |
11 | public enum InterestPriority
12 | {
13 | LOWEST = 0,
14 | BROKEN = 1,
15 | MISSING = 2,
16 | SUSPECT = 4,
17 | SMOKE = 4,
18 | BOX = 5,
19 | DISTRACTIONFLARE = 10,
20 | TERROR = 20
21 | };
22 |
23 |
24 | public class InterestSource : MonoBehaviour
25 | {
26 | public InterestSense sense;
27 | public float radius;
28 | public InterestPriority priority;
29 | public bool active;
30 |
31 | public Interest interest
32 | {
33 | get
34 | {
35 | Interest i;
36 | i.position = transform.position;
37 | i.priority = priority;
38 | i.sense = sense;
39 | return i;
40 | }
41 | }
42 |
43 |
44 | public virtual List GetAffected(AgentAwared[] agentList)
45 | {
46 | List affected;
47 | affected = new List();
48 | Vector3 interPos = transform.position;
49 | Vector3 agentPos;
50 | float distance;
51 | foreach (AgentAwared agent in agentList)
52 | {
53 | agentPos = agent.transform.position;
54 | distance = Vector3.Distance(interPos, agentPos);
55 | if (distance > radius)
56 | continue;
57 | bool isAffected = false;
58 | switch (sense)
59 | {
60 | case InterestSense.SIGHT:
61 | isAffected = IsAffectedSight(agent);
62 | break;
63 | case InterestSense.SOUND:
64 | isAffected = IsAffectedSound(agent);
65 | break;
66 | }
67 |
68 | if (!isAffected)
69 | continue;
70 | affected.Add(agent);
71 | }
72 | return affected;
73 | }
74 |
75 | protected bool IsAffectedSight(AgentAwared agent)
76 | {
77 | // TODO
78 | // your sight check implementation
79 | return false;
80 | }
81 |
82 | protected bool IsAffectedSound(AgentAwared agent)
83 | {
84 | // TODO
85 | // your sound check implementation
86 | return false;
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/InterestSource.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c758df12cea0ae64baded52e5f3aa1be
3 | timeCreated: 1427069983
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/OdourParticle.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class OdourParticle : MonoBehaviour
5 | {
6 | public float timespan;
7 | private float timer;
8 |
9 | public int parent;
10 |
11 | void Start()
12 | {
13 | if (timespan < 0f)
14 | timespan = 0f;
15 | timer = timespan;
16 | }
17 |
18 | void Update()
19 | {
20 | timer -= Time.deltaTime;
21 | if (timer < 0f)
22 | Destroy(gameObject);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/OdourParticle.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eeef8fb50fc50124c95e81ee8452d591
3 | timeCreated: 1425946941
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/SensoryManager.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections.Generic;
3 |
4 | public class SensoryManager : MonoBehaviour
5 | {
6 |
7 | public List agents;
8 | public List sources;
9 |
10 | public void Awake()
11 | {
12 | agents = new List();
13 | sources = new List();
14 | }
15 |
16 | public void UpdateLoop()
17 | {
18 | List affected;
19 | AgentAwared leader;
20 | List scouts;
21 | foreach (InterestSource source in sources)
22 | {
23 | if (!source.active)
24 | continue;
25 | source.active = false;
26 | affected = source.GetAffected(agents.ToArray());
27 | if (affected.Count == 0)
28 | continue;
29 |
30 | int l = Random.Range(0, affected.Count);
31 | leader = affected[l];
32 | scouts = GetScouts(affected.ToArray(), l);
33 | if (leader.Equals(scouts[0]))
34 | StartCoroutine(leader.Lead());
35 | foreach (AgentAwared a in scouts)
36 | {
37 | Interest i = source.interest;
38 | if (a.IsRelevant(i))
39 | a.Notice(i);
40 | }
41 | }
42 | }
43 |
44 | public List GetScouts(AgentAwared[] agents, int leader = -1)
45 | {
46 | if (agents.Length == 0)
47 | return new List();
48 | if (agents.Length == 1)
49 | return new List(agents);
50 |
51 | List agentList;
52 | agentList = new List(agents);
53 | if (leader > -1)
54 | agentList.RemoveAt(leader);
55 | List scouts;
56 | scouts = new List();
57 | float numAgents = (float)agents.Length;
58 | int numScouts = (int)Mathf.Log(numAgents, 2f);
59 | while (numScouts != 0)
60 | {
61 | int numA = agentList.Count;
62 | int r = Random.Range(0, numA);
63 | AgentAwared a = agentList[r];
64 | scouts.Add(a);
65 | agentList.RemoveAt(r);
66 | numScouts--;
67 | }
68 | return scouts;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/SensoryManager.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3f5d4c72984b9e74290be08d292a6fcc
3 | timeCreated: 1427069983
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/Smeller.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class Smeller : MonoBehaviour
6 | {
7 | private Vector3 target;
8 | private Dictionary particles;
9 |
10 | void Start()
11 | {
12 | particles = new Dictionary();
13 | }
14 |
15 | public void OnTriggerEnter(Collider coll)
16 | {
17 | GameObject obj = coll.gameObject;
18 | OdourParticle op;
19 | op = obj.GetComponent();
20 | if (op == null)
21 | return;
22 | int objId = obj.GetInstanceID();
23 | particles.Add(objId, obj);
24 | UpdateTarget();
25 | }
26 |
27 | public void OnTriggerExit(Collider coll)
28 | {
29 | GameObject obj = coll.gameObject;
30 | int objId = obj.GetInstanceID();
31 | bool isRemoved;
32 | isRemoved = particles.Remove(objId);
33 | if (!isRemoved)
34 | return;
35 | UpdateTarget();
36 | }
37 |
38 | private void UpdateTarget()
39 | {
40 | Vector3 centroid = Vector3.zero;
41 | foreach (GameObject p in particles.Values)
42 | {
43 | Vector3 pos = p.transform.position;
44 | centroid += pos;
45 | }
46 | target = centroid;
47 | }
48 |
49 | public Vector3? GetTargetPosition()
50 | {
51 | if (particles.Keys.Count == 0)
52 | return null;
53 | return target;
54 | }
55 |
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/Smeller.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: be79c994700670a4abad8937bd2c2966
3 | timeCreated: 1425948346
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/SoundEmitter.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 26f862c838d53fb409d5876200b91db1
3 | timeCreated: 1426158677
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/SoundReceiver.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class SoundReceiver : MonoBehaviour
5 | {
6 | public float soundThreshold;
7 |
8 | public virtual void Receive(float intensity, Vector3 position)
9 | {
10 | // TODO
11 | // code your own behaviour here
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/SoundReceiver.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 612049607d841c849be734569b5a2bf5
3 | timeCreated: 1426158677
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/VertexOdour.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public class VertexOdour : Vertex
6 | {
7 | private Dictionary odourDic;
8 |
9 | public void Start()
10 | {
11 | odourDic = new Dictionary();
12 | }
13 |
14 | public void OnCollisionEnter(Collision coll)
15 | {
16 | OdourParticle op;
17 | op = coll.gameObject.GetComponent();
18 | if (op == null)
19 | return;
20 | int id = op.parent;
21 | odourDic.Add(id, op);
22 | }
23 |
24 | public void OnCollisionExit(Collision coll)
25 | {
26 | OdourParticle op;
27 | op = coll.gameObject.GetComponent();
28 | if (op == null)
29 | return;
30 | int id = op.parent;
31 | odourDic.Remove(id);
32 | }
33 |
34 | public bool HasOdour()
35 | {
36 | if (odourDic.Values.Count == 0)
37 | return false;
38 | return true;
39 | }
40 |
41 | public bool OdourExists(int id)
42 | {
43 | return odourDic.ContainsKey(id);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/VertexOdour.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 814e826ddf6c4684a96b23201abba49d
3 | timeCreated: 1426478923
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/Visor.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Visor : MonoBehaviour
5 | {
6 | public string tagWall = "Wall";
7 | public string tagTarget = "Enemy";
8 | public GameObject agent;
9 |
10 | // Use this for initialization
11 | void Start()
12 | {
13 | if (agent == null)
14 | agent = gameObject;
15 | }
16 |
17 |
18 |
19 | public void OnTriggerStay(Collider coll)
20 | {
21 | string tag = coll.gameObject.tag;
22 | if (!tag.Equals(tagTarget))
23 | return;
24 | GameObject target = coll.gameObject;
25 | Vector3 agentPos = agent.transform.position;
26 | Vector3 targetPos = target.transform.position;
27 | Vector3 direction = targetPos - agentPos;
28 | float length = direction.magnitude;
29 | direction.Normalize();
30 | Ray ray = new Ray(agentPos, direction);
31 | RaycastHit[] hits;
32 | hits = Physics.RaycastAll(ray, length);
33 | int i;
34 | for (i = 0; i < hits.Length; i++)
35 | {
36 | GameObject hitObj;
37 | hitObj = hits[i].collider.gameObject;
38 | tag = hitObj.tag;
39 | if (tag.Equals(tagWall))
40 | return;
41 | }
42 | // TODO
43 | // target is visible
44 | // code your behaviour below
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/Visor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 023429c6d2cf13442a5f9fb290d6ffaf
3 | timeCreated: 1425941421
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/VisorGraph.cs:
--------------------------------------------------------------------------------
1 | //using UnityEngine;
2 | //using System.Collections;
3 | //using System.Collections.Generic;
4 |
5 | //public class VisorGraph : MonoBehaviour
6 | //{
7 | // public int visionReach;
8 | // public GameObject visorObj;
9 | // public Graph visionGraph;
10 |
11 | // void Start()
12 | // {
13 | // if (visorObj == null)
14 | // visorObj = gameObject;
15 | // }
16 |
17 | // public bool IsVisible(int[] visibilityNodes)
18 | // {
19 | // int vision = visionReach;
20 | // int src = visionGraph.GetNearestVertex(visorObj);
21 | // HashSet visibleNodes = new HashSet();
22 | // Queue queue = new Queue();
23 | // queue.Enqueue(src);
24 | // while (queue.Count != 0)
25 | // {
26 | // if (vision == 0)
27 | // break;
28 | // int v = queue.Dequeue();
29 | // List neighbours = visionGraph.GetNeighbours(v);
30 | // foreach (int n in neighbours)
31 | // {
32 | // if (visibleNodes.Contains(n))
33 | // continue;
34 | // queue.Enqueue(v);
35 | // visibleNodes.Add(v);
36 | // }
37 | // }
38 | // foreach (int vn in visibleNodes)
39 | // {
40 | // if (visibleNodes.Contains(vn))
41 | // return true;
42 | // }
43 | // return false;
44 | // }
45 | //}
46 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch05AgentAwareness/VisorGraph.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d03db515e8b77e04c9715e3720ed99d5
3 | timeCreated: 1426719420
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f41567a75f77eab48af01d605ab8e3d9
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/Board.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class Board
5 | {
6 | protected int player;
7 |
8 | public Board()
9 | {
10 | player = 1;
11 | }
12 |
13 |
14 | public virtual Move[] GetMoves()
15 | {
16 | return new Move[0];
17 | }
18 |
19 | public virtual Board MakeMove(Move m)
20 | {
21 | return new Board();
22 | }
23 |
24 | public virtual bool IsGameOver()
25 | {
26 | return true;
27 | }
28 |
29 | public virtual int GetCurrentPlayer()
30 | {
31 | return player;
32 | }
33 |
34 | public virtual float Evaluate(int player)
35 | {
36 | return Mathf.NegativeInfinity;
37 | }
38 |
39 | // new function for negamax
40 | public virtual float Evaluate()
41 | {
42 | return Mathf.NegativeInfinity;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/Board.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 482490265098a984fa073473b70125ac
3 | timeCreated: 1430153830
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/BoardAi.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5e2148c6e62c94849add40078140457d
3 | timeCreated: 1430236130
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/BoardDraughts.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b0c8928ace33f5c40865b387ab33dd83
3 | timeCreated: 1432848786
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/BoardTicTac.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d3489226f90b6b8488363af9a8823e9a
3 | timeCreated: 1430748119
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/Move.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public abstract class Move
5 | {
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/Move.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ce3df06ec67fd7843b40cd896eae3b79
3 | timeCreated: 1430158597
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/MoveDraughts.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class MoveDraughts : Move
5 | {
6 | public int x;
7 | public int y;
8 | public bool success;
9 | public int removeX;
10 | public int removeY;
11 | public PieceDraughts piece;
12 | }
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/MoveDraughts.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4010534999328134b8f4cc5f1d388550
3 | timeCreated: 1432851921
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/MoveTicTac.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class MoveTicTac : Move
5 | {
6 | public int x;
7 | public int y;
8 | public int player;
9 |
10 | public MoveTicTac(int x, int y, int player)
11 | {
12 | this.x = x;
13 | this.y = y;
14 | this.player = player;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/MoveTicTac.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 80510e37958b1fc4ba661b0a6e5f47d5
3 | timeCreated: 1430752088
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch06BoardGamesAI/PieceDraughts.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 005bd57bc0fb76a4583811fed0aafd8b
3 | timeCreated: 1432848785
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e5a9a6fd5addbf14598eef226e41c80f
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/DecisionNode.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | public class DecisionNode
4 | {
5 | public string testValue;
6 | public Dictionary children;
7 |
8 | public DecisionNode(string testValue = "")
9 | {
10 | this.testValue = testValue;
11 | children = new Dictionary();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/DecisionNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7ced11c4d7469d842a9c9c0e28a3a732
3 | timeCreated: 1440353289
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/HarmonySearch.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class HarmonySearch : MonoBehaviour
5 | {
6 | [Range(1, 100)]
7 | public int memorySize = 30;
8 | public int pitchNum;
9 | // consolidation rate
10 | [Range(0.1f, 0.99f)]
11 | public float consRate = 0.9f;
12 | // adjustment rate
13 | [Range(0.1f, 0.99f)]
14 | public float adjsRate = 0.7f;
15 | public float range = 0.05f;
16 | public int numIterations;
17 | [Range(0.1f, 1.0f)]
18 | public float par = 0.3f;
19 |
20 | public Vector2[] bounds;
21 |
22 | private float[,] memory;
23 | private float[] solution;
24 |
25 | // Use this for initialization
26 | void Start()
27 | {
28 | }
29 |
30 |
31 | public void Init()
32 | {
33 | memory = new float[memorySize, pitchNum];
34 | solution = new float[memorySize];
35 | }
36 |
37 | public float[] Run()
38 | {
39 | return solution;
40 | }
41 |
42 | private float GetRandInBounds(Vector2 range)
43 | {
44 | return Random.Range(range.x, range.y);
45 | }
46 |
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/HarmonySearch.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 31331b7f093b58248b21d3419ef56e54
3 | timeCreated: 1439223189
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/HierarchicalNGramP.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Text;
4 |
5 | public class HierarchicalNGramP
6 | {
7 |
8 | public int threshold;
9 | public NGramPredictor[] predictors;
10 | private int nValue;
11 |
12 |
13 | public HierarchicalNGramP(int windowSize)
14 | {
15 | nValue = windowSize + 1;
16 | predictors = new NGramPredictor[nValue];
17 | int i;
18 | for (i = 0; i < nValue; i++)
19 | predictors[i] = new NGramPredictor(i + 1);
20 | }
21 |
22 | public void RegisterSequence(T[] actions)
23 | {
24 | int i;
25 | for (i = 0; i < nValue; i++)
26 | {
27 | T[] subactions = new T[i+1];
28 | Array.Copy(actions, nValue - i - 1, subactions, 0, i+1);
29 | predictors[i].RegisterSequence(subactions);
30 | }
31 | }
32 |
33 | public T GetMostLikely(T[] actions)
34 | {
35 | int i;
36 | T bestAction = default(T);
37 | for (i = 0; i < nValue; i++)
38 | {
39 | NGramPredictor p;
40 | p = predictors[nValue - i - 1];
41 | T[] subactions = new T[i + 1];
42 | Array.Copy(actions, nValue - i - 1, subactions, 0, i + 1);
43 | int numActions = p.GetActionsNum(ref actions);
44 | if (numActions > threshold)
45 | bestAction = p.GetMostLikely(actions);
46 | }
47 | return bestAction;
48 | }
49 |
50 | private string ArrToStrKey(ref T[] actions)
51 | {
52 | StringBuilder builder = new StringBuilder();
53 | foreach (T a in actions)
54 | {
55 | builder.Append(a.ToString());
56 | }
57 | return builder.ToString();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/HierarchicalNGramP.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3c3fe0a2187ec3144a1d1d687a6bb6ab
3 | timeCreated: 1436716832
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/ID3.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6df0287eaf205e34e98efd53022f4de7
3 | timeCreated: 1440349202
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/ID3Example.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections.Generic;
3 |
4 | public enum ID3Action
5 | {
6 | STOP, WALK, RUN
7 | }
8 |
9 | public class ID3Example : MonoBehaviour
10 | {
11 | public ID3Action action;
12 | public Dictionary values;
13 |
14 | public float GetValue(string attribute)
15 | {
16 | return values[attribute];
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/ID3Example.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d86ddcebf07802342b2e048f934b6150
3 | timeCreated: 1440345318
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/KeyDataRecord.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 |
4 | public class KeyDataRecord
5 | {
6 | public Dictionary counts;
7 | public int total;
8 |
9 | public KeyDataRecord()
10 | {
11 | counts = new Dictionary();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/KeyDataRecord.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0e983cff4dcb7384d8b9b1855660aa98
3 | timeCreated: 1435581566
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/MLPNetwork.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class MLPNetwork : MonoBehaviour
5 | {
6 |
7 | public Perceptron[] inputPer;
8 | public Perceptron[] hiddenPer;
9 | public Perceptron[] outputPer;
10 |
11 | public void GenerateOutput(Perceptron[] inputs)
12 | {
13 | int i;
14 | for (i = 0; i < inputs.Length; i++)
15 | inputPer[i].state = inputs[i].input;
16 |
17 | for (i = 0; i < hiddenPer.Length; i++)
18 | hiddenPer[i].FeedForward();
19 |
20 | for (i = 0; i < outputPer.Length; i++)
21 | outputPer[i].FeedForward();
22 | }
23 |
24 | public void BackProp(Perceptron[] outputs)
25 | {
26 | int i;
27 | for (i = 0; i < outputPer.Length; i++)
28 | {
29 | Perceptron p = outputPer[i];
30 | float state = p.state;
31 |
32 | float error = state * (1f - state);
33 | error *= outputs[i].state - state;
34 |
35 | p.AdjustWeights(error);
36 | }
37 |
38 | for (i = 0; i < hiddenPer.Length; i++)
39 | {
40 | Perceptron p = outputPer[i];
41 | float state = p.state;
42 |
43 | float sum = 0f;
44 |
45 | for (i = 0; i < outputs.Length; i++)
46 | {
47 | float incomingW = outputs[i].GetIncomingWeight();
48 | sum += incomingW * outputs[i].error;
49 |
50 | float error = state * (1f - state) * sum;
51 |
52 | p.AdjustWeights(error);
53 | }
54 | }
55 | }
56 |
57 | public void Learn(
58 | Perceptron[] inputs,
59 | Perceptron[] outputs)
60 | {
61 | GenerateOutput(inputs);
62 | BackProp(outputs);
63 | }
64 |
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/MLPNetwork.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6f5ca996799bdbe4ead373d047377fee
3 | timeCreated: 1440670799
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/NGramPredictor.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | public class NGramPredictor
6 | {
7 | private int nValue;
8 | private Dictionary> data;
9 |
10 | public NGramPredictor(int windowSize)
11 | {
12 | nValue = windowSize + 1;
13 | data = new Dictionary>();
14 | }
15 |
16 | public void RegisterSequence(T[] actions)
17 | {
18 | string key = ArrToStrKey(ref actions);
19 | T val = actions[nValue - 1];
20 | if (!data.ContainsKey(key))
21 | data[key] = new KeyDataRecord();
22 | KeyDataRecord kdr = data[key];
23 | if (kdr.counts.ContainsKey(val))
24 | kdr.counts[val] = 0;
25 | kdr.counts[val]++;
26 | kdr.total++;
27 | }
28 |
29 | public T GetMostLikely(T[] actions)
30 | {
31 | string key = ArrToStrKey(ref actions);
32 | KeyDataRecord kdr = data[key];
33 | int highestVal = 0;
34 | T bestAction = default(T);
35 | foreach (KeyValuePair kvp in kdr.counts)
36 | {
37 | if (kvp.Value > highestVal)
38 | {
39 | bestAction = kvp.Key;
40 | highestVal = kvp.Value;
41 | }
42 | }
43 | return bestAction;
44 | }
45 |
46 | public static string ArrToStrKey(ref T[] actions)
47 | {
48 | StringBuilder builder = new StringBuilder();
49 | foreach (T a in actions)
50 | {
51 | builder.Append(a.ToString());
52 | }
53 | return builder.ToString();
54 | }
55 |
56 | public int GetActionsNum(ref T[] actions)
57 | {
58 | string key = ArrToStrKey(ref actions);
59 | if (!data.ContainsKey(key))
60 | return 0;
61 | return data[key].total;
62 | }
63 | }
64 |
65 | /*
66 | * data type T must have the following
67 | * - uniqueness
68 | * - ToString method implementation
69 | */
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/NGramPredictor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 72bfd852a1a87bd4bbed35d9e7ed89ff
3 | timeCreated: 1435581573
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/NaiveBayesClassifier.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 |
5 | public enum NBCLabel
6 | {
7 | POSITIVE,
8 | NEGATIVE
9 | }
10 |
11 | public class NaiveBayesClassifier : MonoBehaviour
12 | {
13 |
14 | public int numAttributes;
15 | public int numExamplesPositive;
16 | public int numExamplesNegative;
17 |
18 | public List attrCountPositive;
19 | public List attrCountNegative;
20 |
21 | void Awake()
22 | {
23 | attrCountPositive = new List();
24 | attrCountNegative = new List();
25 | }
26 |
27 | public void UpdateClassifier(bool[] attributes, NBCLabel label)
28 | {
29 | if (label == NBCLabel.POSITIVE)
30 | {
31 | numExamplesPositive++;
32 | attrCountPositive.AddRange(attributes);
33 | }
34 | else
35 | {
36 | numExamplesNegative++;
37 | attrCountNegative.AddRange(attributes);
38 | }
39 | }
40 |
41 | public bool Predict(bool[] attributes)
42 | {
43 | float nep = numExamplesPositive;
44 | float nen = numExamplesNegative;
45 | float x = NaiveProbabilities(ref attributes, attrCountPositive.ToArray(), nep, nen);
46 | float y = NaiveProbabilities(ref attributes, attrCountNegative.ToArray(), nen, nep);
47 | if (x >= y)
48 | return true;
49 | return false;
50 | }
51 |
52 | public float NaiveProbabilities(
53 | ref bool[] attributes,
54 | bool[] counts,
55 | float m,
56 | float n)
57 | {
58 | float prior = m / (m + n);
59 | float p = 1f;
60 | int i = 0;
61 | for (i = 0; i < numAttributes; i++)
62 | {
63 | p /= m;
64 | if (attributes[i] == true)
65 | p *= counts[i].GetHashCode();
66 | else
67 | p *= m - counts[i].GetHashCode();
68 | }
69 | return prior * p;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/NaiveBayesClassifier.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 09ece1a157c00d54b88f03453371a37d
3 | timeCreated: 1436732781
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/Perceptron.cs:
--------------------------------------------------------------------------------
1 | public class InputPerceptron
2 | {
3 | public float input;
4 | public float weight;
5 | }
6 |
7 | public class Perceptron : InputPerceptron
8 | {
9 | public InputPerceptron[] inputList;
10 | public delegate float Threshold(float x);
11 | public Threshold threshold;
12 | public float state;
13 | public float error;
14 |
15 | public Perceptron(int inputSize)
16 | {
17 | inputList = new InputPerceptron[inputSize];
18 | }
19 |
20 | public void FeedForward()
21 | {
22 | float sum = 0f;
23 | foreach (InputPerceptron i in inputList)
24 | {
25 | sum += i.input * i.weight;
26 | }
27 | state = threshold(sum);
28 | }
29 |
30 | public void AdjustWeights(float currentError)
31 | {
32 | int i;
33 | for (i = 0; i < inputList.Length; i++)
34 | {
35 | float deltaWeight;
36 | deltaWeight = currentError * inputList[i].weight * state;
37 | inputList[i].weight = deltaWeight;
38 | error = currentError;
39 | }
40 | }
41 |
42 | public float GetIncomingWeight()
43 | {
44 | foreach (InputPerceptron i in inputList)
45 | {
46 | if (i.GetType() == typeof(Perceptron))
47 | return i.weight;
48 | }
49 | return 0f;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/Perceptron.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5732026eeaae269499f03b4eefee2c14
3 | timeCreated: 1440670799
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/QLearning.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class QLearning : MonoBehaviour
5 | {
6 |
7 | public QValueStore store;
8 |
9 |
10 | private GameAction GetRandomAction(GameAction[] actions)
11 | {
12 | int n = actions.Length;
13 | return actions[Random.Range(0, n)];
14 | }
15 |
16 | public IEnumerator Learn(
17 | ReinforcementProblem problem,
18 | int numIterations,
19 | float alpha,
20 | float gamma,
21 | float rho,
22 | float nu)
23 | {
24 | if (store == null)
25 | yield break;
26 |
27 | GameState state = problem.GetRandomState();
28 | for (int i = 0; i < numIterations; i++)
29 | {
30 | yield return null;
31 | if (Random.value < nu)
32 | state = problem.GetRandomState();
33 | GameAction[] actions;
34 | actions = problem.GetAvailableActions(state);
35 | GameAction action;
36 | if (Random.value < rho)
37 | action = GetRandomAction(actions);
38 | else
39 | action = store.GetBestAction(state);
40 | float reward = 0f;
41 | GameState newState;
42 | newState = problem.TakeAction(state, action, ref reward);
43 | float q = store.GetQValue(state, action);
44 | GameAction bestAction = store.GetBestAction(newState);
45 | float maxQ = store.GetQValue(newState, bestAction);
46 | // perform QLearning
47 | q = (1f - alpha) * q + alpha * (reward + gamma * maxQ);
48 | store.StoreQValue(state, action, q);
49 | state = newState;
50 | }
51 | yield break;
52 | }
53 |
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/QLearning.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eee2fd6ede77b73479023c1d8fd8d627
3 | timeCreated: 1440446782
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/QValueStore.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections.Generic;
3 |
4 |
5 | public class QValueStore : MonoBehaviour
6 | {
7 | private Dictionary> store;
8 |
9 | public QValueStore()
10 | {
11 | store = new Dictionary>();
12 | }
13 |
14 | public virtual float GetQValue(GameState s, GameAction a)
15 | {
16 | // TODO: your behaviour here
17 | return 0f;
18 | }
19 |
20 | public virtual GameAction GetBestAction(GameState s)
21 | {
22 | // TODO: your behaviour here
23 | return new GameAction();
24 | }
25 |
26 | public void StoreQValue(
27 | GameState s,
28 | GameAction a,
29 | float val)
30 | {
31 | if (!store.ContainsKey(s))
32 | {
33 | Dictionary d;
34 | d = new Dictionary();
35 | store.Add(s, d);
36 | }
37 | if (!store[s].ContainsKey(a))
38 | {
39 | store[s].Add(a, 0f);
40 | }
41 | store[s][a] = val;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/QValueStore.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ddf9e4c0b44b57e42bd47616ec3d3261
3 | timeCreated: 1440361633
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/ReinforcementProblem.cs:
--------------------------------------------------------------------------------
1 | public struct GameState
2 | {
3 | // TODO
4 | // your state definition here
5 | }
6 |
7 | public struct GameAction
8 | {
9 | // TODO
10 | // your action definition here
11 | }
12 |
13 |
14 | public class ReinforcementProblem
15 | {
16 | public virtual GameState GetRandomState()
17 | {
18 | // TODO
19 | // Define your own behaviour
20 | return new GameState();
21 | }
22 |
23 | public virtual GameAction[] GetAvailableActions(GameState s)
24 | {
25 | // TODO
26 | // Define your own behaviour
27 | return new GameAction[0];
28 | }
29 |
30 | public virtual GameState TakeAction(
31 | GameState s,
32 | GameAction a,
33 | ref float reward)
34 | {
35 | // TODO
36 | // Define your own behaviour
37 | reward = 0f;
38 | return new GameState();
39 | }
40 | }
41 |
42 |
43 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch07LearningTechniques/ReinforcementProblem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 31d3c30761c0303449b80f74634040a0
3 | timeCreated: 1440446782
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c5bdda34850c165458690c1bea8dc9b9
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/AirHockeyRival.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 432c25ce32e096a4dba5e265a1d86905
3 | timeCreated: 1447467151
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/BSPNode.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | [System.Serializable]
4 | public class BSPNode
5 | {
6 | public Rect rect;
7 | public BSPNode nodeA;
8 | public BSPNode nodeB;
9 |
10 | public BSPNode(Rect r, BSPNode nA = null, BSPNode nB = null)
11 | {
12 | rect = r;
13 | nodeA = nA;
14 | nodeB = nB;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/BSPNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bf3e653ea2df46942918ba4e78ecf185
3 | timeCreated: 1450327644
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/Dungeon.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4f57b21bb0ed09b4eac0ee7ded7a8702
3 | timeCreated: 1450666435
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/RandomGaussian.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 |
4 | public class RandomGaussian
5 | {
6 | public static ulong seed = 61829450;
7 |
8 | public static float Range()
9 | {
10 | double sum = 0;
11 | for (int i = 0; i < 3; i++)
12 | {
13 | ulong holdseed = seed;
14 | seed ^= seed << 13;
15 | seed ^= seed >> 17;
16 | seed ^= seed << 5;
17 | long r = (long)(holdseed * seed);
18 | sum += r * (1.0 / 0x7FFFFFFFFFFFFFFF);
19 | }
20 | return (float)sum;
21 | }
22 |
23 | public static float RangeAdditive(params Vector2[] values)
24 | {
25 | float sum = 0f;
26 | int i;
27 | float min, max;
28 | if (values.Length == 0)
29 | {
30 | values = new Vector2[3];
31 | for (i = 0; i < values.Length; i++)
32 | values[i] = new Vector2(0f, 1f);
33 | }
34 |
35 | for (i = 0; i < values.Length; i++)
36 | {
37 | min = values[i].x;
38 | max = values[i].y;
39 | sum += Random.Range(min, max);
40 | }
41 | return sum;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/RandomGaussian.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d42032bb865d93b4e922f2f8748b5414
3 | timeCreated: 1446694450
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/TFRBar.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class TFRBar : MonoBehaviour
5 | {
6 | [HideInInspector]
7 | public int barId;
8 | public float barSpeed;
9 | public float attackDegrees = 30f;
10 | public float defendDegrees = 0f;
11 | public float openDegrees = 90f;
12 |
13 | public GameObject ball;
14 | private Coroutine crTransition;
15 | private bool isLocked;
16 |
17 | void Awake()
18 | {
19 | crTransition = null;
20 | isLocked = false;
21 | }
22 |
23 | public void SetState(TFRState state, float speed = 0f)
24 | {
25 | if (isLocked)
26 | return;
27 | // optional
28 | isLocked = true;
29 | if (speed == 0)
30 | speed = barSpeed;
31 | float degrees = 0f;
32 | switch(state)
33 | {
34 | case TFRState.ATTACK:
35 | degrees = attackDegrees;
36 | break;
37 | default:
38 | case TFRState.DEFEND:
39 | degrees = defendDegrees;
40 | break;
41 | case TFRState.OPEN:
42 | degrees = openDegrees;
43 | break;
44 | }
45 | if (crTransition != null)
46 | StopCoroutine(crTransition);
47 | crTransition = StartCoroutine(Rotate(degrees, speed));
48 | }
49 |
50 | public IEnumerator Rotate(float target, float speed)
51 | {
52 | while (transform.rotation.x != target)
53 | {
54 | Quaternion rot = transform.rotation;
55 | if (Mathf.Approximately(rot.x, target))
56 | {
57 | rot.x = target;
58 | transform.rotation = rot;
59 | }
60 | float vel = target - rot.x;
61 | rot.x += speed * Time.deltaTime * vel;
62 | yield return null;
63 | }
64 | isLocked = false;
65 | transform.rotation = Quaternion.identity;
66 | }
67 |
68 | public void Slide(float target, float speed)
69 | {
70 | Vector3 targetPos = transform.position;
71 | targetPos.x = target;
72 | Vector3 trans = transform.position - targetPos;
73 | trans *= speed * Time.deltaTime;
74 | transform.Translate(trans, Space.World);
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/TFRBar.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c3f87b1b89483c8419610e8f4957d0ba
3 | timeCreated: 1448317956
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/TFRival.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2d60e327cc05b5c45939b7bd05a8aa1a
3 | timeCreated: 1448001420
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/Track.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections.Generic;
3 |
4 | public class Track : MonoBehaviour
5 | {
6 |
7 | LinkedList sections;
8 |
9 | void Awake()
10 | {
11 | TrackSection[] trackSections;
12 | trackSections = FindObjectsOfType();
13 | TrackSection section = null;
14 | foreach (TrackSection ts in trackSections)
15 | {
16 | if (ts.initialSection)
17 | {
18 | section = ts;
19 | break;
20 | }
21 | }
22 | if (ReferenceEquals(section, null))
23 | return;
24 |
25 | }
26 | // Use this for initialization
27 | void Start()
28 | {
29 |
30 | }
31 |
32 | // Update is called once per frame
33 | void Update()
34 | {
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/Track.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8ab0b488fd26a4e438cf4e3acb9218cd
3 | timeCreated: 1450839606
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/TrackSection.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 |
4 | public class TrackSection : MonoBehaviour
5 | {
6 | public bool initialSection;
7 | public GameObject backL;
8 | public GameObject backR;
9 | public GameObject frntL;
10 | public GameObject frntR;
11 | public TrackSection next;
12 |
13 | private GameObject backCentroid;
14 | private GameObject frntCentroid;
15 |
16 | private float length;
17 |
18 | public float Length
19 | {
20 | get { return length; }
21 | }
22 |
23 | void Awake()
24 | {
25 | Vector3 centroid = backL.transform.position;
26 | centroid += backR.transform.position;
27 | centroid /= 2f;
28 | backCentroid = new GameObject();
29 | backCentroid.transform.position = centroid;
30 | centroid = frntL.transform.position;
31 | centroid += frntR.transform.position;
32 | centroid /= 2f;
33 | frntCentroid = new GameObject();
34 | frntCentroid.transform.position = centroid;
35 | length = Vector3.Distance(backCentroid.transform.position, centroid);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Ch08Miscellaneous/TrackSection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f966c7691ea1981448229034e180450c
3 | timeCreated: 1450839606
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Utils.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6254d253322e9594787e74c80a010e97
3 | folderAsset: yes
4 | DefaultImporter:
5 | userData:
6 |
--------------------------------------------------------------------------------
/UAIPC/Assets/Scripts/Utils/TesterGraph.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a432c99379c94694c88aacbe7fae072d
3 | timeCreated: 1456173628
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!11 &1
4 | AudioManager:
5 | m_ObjectHideFlags: 0
6 | m_Volume: 1
7 | Rolloff Scale: 1
8 | m_SpeedOfSound: 347
9 | Doppler Factor: 1
10 | Default Speaker Mode: 2
11 | m_DSPBufferSize: 0
12 | m_DisableAudio: 0
13 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!236 &1
4 | ClusterInputManager:
5 | m_ObjectHideFlags: 0
6 | m_Inputs: []
7 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!55 &1
4 | PhysicsManager:
5 | m_ObjectHideFlags: 0
6 | m_Gravity: {x: 0, y: -9.81000042, z: 0}
7 | m_DefaultMaterial: {fileID: 0}
8 | m_BounceThreshold: 2
9 | m_SleepVelocity: .150000006
10 | m_SleepAngularVelocity: .140000001
11 | m_MaxAngularVelocity: 7
12 | m_MinPenetrationForPenalty: .00999999978
13 | m_SolverIterationCount: 6
14 | m_RaycastsHitTriggers: 1
15 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
16 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1045 &1
4 | EditorBuildSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Scenes: []
8 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!159 &1
4 | EditorSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 3
7 | m_ExternalVersionControlSupport: Visible Meta Files
8 | m_SerializationMode: 2
9 | m_WebSecurityEmulationEnabled: 0
10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d
11 | m_DefaultBehaviorMode: 0
12 | m_SpritePackerMode: 0
13 | m_SpritePackerPaddingPower: 1
14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd
15 | m_ProjectGenerationRootNamespace:
16 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!30 &1
4 | GraphicsSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 5
7 | m_Deferred:
8 | m_Mode: 1
9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
10 | m_DeferredReflections:
11 | m_Mode: 1
12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
13 | m_LegacyDeferred:
14 | m_Mode: 1
15 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
16 | m_AlwaysIncludedShaders:
17 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
18 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
19 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
20 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
21 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
22 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
23 | m_PreloadedShaders: []
24 | m_ShaderSettings:
25 | useScreenSpaceShadows: 1
26 | m_BuildTargetShaderSettings: []
27 | m_LightmapStripping: 0
28 | m_FogStripping: 0
29 | m_LightmapKeepPlain: 1
30 | m_LightmapKeepDirCombined: 1
31 | m_LightmapKeepDirSeparate: 1
32 | m_LightmapKeepDynamicPlain: 1
33 | m_LightmapKeepDynamicDirCombined: 1
34 | m_LightmapKeepDynamicDirSeparate: 1
35 | m_FogKeepLinear: 1
36 | m_FogKeepExp: 1
37 | m_FogKeepExp2: 1
38 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!126 &1
4 | NavMeshLayers:
5 | m_ObjectHideFlags: 0
6 | Built-in Layer 0:
7 | name: Default
8 | cost: 1
9 | editType: 2
10 | Built-in Layer 1:
11 | name: Not Walkable
12 | cost: 1
13 | editType: 0
14 | Built-in Layer 2:
15 | name: Jump
16 | cost: 2
17 | editType: 2
18 | User Layer 0:
19 | name:
20 | cost: 1
21 | editType: 3
22 | User Layer 1:
23 | name:
24 | cost: 1
25 | editType: 3
26 | User Layer 2:
27 | name:
28 | cost: 1
29 | editType: 3
30 | User Layer 3:
31 | name:
32 | cost: 1
33 | editType: 3
34 | User Layer 4:
35 | name:
36 | cost: 1
37 | editType: 3
38 | User Layer 5:
39 | name:
40 | cost: 1
41 | editType: 3
42 | User Layer 6:
43 | name:
44 | cost: 1
45 | editType: 3
46 | User Layer 7:
47 | name:
48 | cost: 1
49 | editType: 3
50 | User Layer 8:
51 | name:
52 | cost: 1
53 | editType: 3
54 | User Layer 9:
55 | name:
56 | cost: 1
57 | editType: 3
58 | User Layer 10:
59 | name:
60 | cost: 1
61 | editType: 3
62 | User Layer 11:
63 | name:
64 | cost: 1
65 | editType: 3
66 | User Layer 12:
67 | name:
68 | cost: 1
69 | editType: 3
70 | User Layer 13:
71 | name:
72 | cost: 1
73 | editType: 3
74 | User Layer 14:
75 | name:
76 | cost: 1
77 | editType: 3
78 | User Layer 15:
79 | name:
80 | cost: 1
81 | editType: 3
82 | User Layer 16:
83 | name:
84 | cost: 1
85 | editType: 3
86 | User Layer 17:
87 | name:
88 | cost: 1
89 | editType: 3
90 | User Layer 18:
91 | name:
92 | cost: 1
93 | editType: 3
94 | User Layer 19:
95 | name:
96 | cost: 1
97 | editType: 3
98 | User Layer 20:
99 | name:
100 | cost: 1
101 | editType: 3
102 | User Layer 21:
103 | name:
104 | cost: 1
105 | editType: 3
106 | User Layer 22:
107 | name:
108 | cost: 1
109 | editType: 3
110 | User Layer 23:
111 | name:
112 | cost: 1
113 | editType: 3
114 | User Layer 24:
115 | name:
116 | cost: 1
117 | editType: 3
118 | User Layer 25:
119 | name:
120 | cost: 1
121 | editType: 3
122 | User Layer 26:
123 | name:
124 | cost: 1
125 | editType: 3
126 | User Layer 27:
127 | name:
128 | cost: 1
129 | editType: 3
130 | User Layer 28:
131 | name:
132 | cost: 1
133 | editType: 3
134 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/NavMeshLayers.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!126 &1
4 | NavMeshLayers:
5 | m_ObjectHideFlags: 0
6 | Built-in Layer 0:
7 | name: Default
8 | cost: 1
9 | editType: 2
10 | Built-in Layer 1:
11 | name: Not Walkable
12 | cost: 1
13 | editType: 0
14 | Built-in Layer 2:
15 | name: Jump
16 | cost: 2
17 | editType: 2
18 | User Layer 0:
19 | name:
20 | cost: 1
21 | editType: 3
22 | User Layer 1:
23 | name:
24 | cost: 1
25 | editType: 3
26 | User Layer 2:
27 | name:
28 | cost: 1
29 | editType: 3
30 | User Layer 3:
31 | name:
32 | cost: 1
33 | editType: 3
34 | User Layer 4:
35 | name:
36 | cost: 1
37 | editType: 3
38 | User Layer 5:
39 | name:
40 | cost: 1
41 | editType: 3
42 | User Layer 6:
43 | name:
44 | cost: 1
45 | editType: 3
46 | User Layer 7:
47 | name:
48 | cost: 1
49 | editType: 3
50 | User Layer 8:
51 | name:
52 | cost: 1
53 | editType: 3
54 | User Layer 9:
55 | name:
56 | cost: 1
57 | editType: 3
58 | User Layer 10:
59 | name:
60 | cost: 1
61 | editType: 3
62 | User Layer 11:
63 | name:
64 | cost: 1
65 | editType: 3
66 | User Layer 12:
67 | name:
68 | cost: 1
69 | editType: 3
70 | User Layer 13:
71 | name:
72 | cost: 1
73 | editType: 3
74 | User Layer 14:
75 | name:
76 | cost: 1
77 | editType: 3
78 | User Layer 15:
79 | name:
80 | cost: 1
81 | editType: 3
82 | User Layer 16:
83 | name:
84 | cost: 1
85 | editType: 3
86 | User Layer 17:
87 | name:
88 | cost: 1
89 | editType: 3
90 | User Layer 18:
91 | name:
92 | cost: 1
93 | editType: 3
94 | User Layer 19:
95 | name:
96 | cost: 1
97 | editType: 3
98 | User Layer 20:
99 | name:
100 | cost: 1
101 | editType: 3
102 | User Layer 21:
103 | name:
104 | cost: 1
105 | editType: 3
106 | User Layer 22:
107 | name:
108 | cost: 1
109 | editType: 3
110 | User Layer 23:
111 | name:
112 | cost: 1
113 | editType: 3
114 | User Layer 24:
115 | name:
116 | cost: 1
117 | editType: 3
118 | User Layer 25:
119 | name:
120 | cost: 1
121 | editType: 3
122 | User Layer 26:
123 | name:
124 | cost: 1
125 | editType: 3
126 | User Layer 27:
127 | name:
128 | cost: 1
129 | editType: 3
130 | User Layer 28:
131 | name:
132 | cost: 1
133 | editType: 3
134 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/NetworkManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!149 &1
4 | NetworkManager:
5 | m_ObjectHideFlags: 0
6 | m_DebugLevel: 0
7 | m_Sendrate: 15
8 | m_AssetToPrefab: {}
9 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!19 &1
4 | Physics2DSettings:
5 | m_ObjectHideFlags: 0
6 | m_Gravity: {x: 0, y: -9.81000042}
7 | m_DefaultMaterial: {fileID: 0}
8 | m_VelocityIterations: 8
9 | m_PositionIterations: 3
10 | m_VelocityThreshold: 1
11 | m_MaxLinearCorrection: .200000003
12 | m_MaxAngularCorrection: 8
13 | m_MaxTranslationSpeed: 100
14 | m_MaxRotationSpeed: 360
15 | m_BaumgarteScale: .200000003
16 | m_BaumgarteTimeOfImpactScale: .75
17 | m_TimeToSleep: .5
18 | m_LinearSleepTolerance: .00999999978
19 | m_AngularSleepTolerance: 2
20 | m_RaycastsHitTriggers: 1
21 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
22 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 5.3.4f1
2 | m_StandardAssetsVersion: 0
3 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!78 &1
4 | TagManager:
5 | serializedVersion: 2
6 | tags:
7 | - Agent
8 | - Wall
9 | - Vertex
10 | - Obstacle
11 | layers:
12 | - Default
13 | - TransparentFX
14 | - Ignore Raycast
15 | -
16 | - Water
17 | - UI
18 | -
19 | -
20 | - Wall
21 | -
22 | -
23 | -
24 | -
25 | -
26 | -
27 | -
28 | -
29 | -
30 | -
31 | -
32 | -
33 | -
34 | -
35 | -
36 | -
37 | -
38 | -
39 | -
40 | -
41 | -
42 | -
43 | -
44 | m_SortingLayers:
45 | - name: Default
46 | uniqueID: 0
47 | locked: 0
48 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!5 &1
4 | TimeManager:
5 | m_ObjectHideFlags: 0
6 | Fixed Timestep: .0199999996
7 | Maximum Allowed Timestep: .333333343
8 | m_TimeScale: 1
9 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/UnityAdsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!292 &1
4 | UnityAdsSettings:
5 | m_ObjectHideFlags: 0
6 | m_Enabled: 0
7 | m_InitializeOnStartup: 1
8 | m_TestMode: 0
9 | m_EnabledPlatforms: 4294967295
10 | m_IosGameId:
11 | m_AndroidGameId:
12 |
--------------------------------------------------------------------------------
/UAIPC/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!310 &1
4 | UnityConnectSettings:
5 | m_ObjectHideFlags: 0
6 | UnityPurchasingSettings:
7 | m_Enabled: 0
8 | m_TestMode: 0
9 | UnityAnalyticsSettings:
10 | m_Enabled: 0
11 | m_InitializeOnStartup: 1
12 | m_TestMode: 0
13 | m_TestEventUrl:
14 | m_TestConfigUrl:
15 |
--------------------------------------------------------------------------------