Skip to content

Commit 8a00fa7

Browse files
authored
[HP 8] Completed feature 'Character Movement Integration' with tests
* [HP-9] Completed task 'Add component' * [HP-10] Completed task 'Setup character prefab' with tests
1 parent 6372a96 commit 8a00fa7

File tree

9 files changed

+360
-193
lines changed

9 files changed

+360
-193
lines changed

Assets/GameTests/GameTests.asmdef

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"references": [
44
"UnityEngine.TestRunner",
55
"UnityEditor.TestRunner",
6-
"Scripts"
6+
"Scripts",
7+
"MichaelRRyan.TopdownCharacterController"
78
],
89
"includePlatforms": [],
910
"excludePlatforms": [],

Assets/GameTests/PlayerTests.cs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using NUnit.Framework;
4+
using UnityEngine;
5+
using UnityEngine.SceneManagement;
6+
using UnityEngine.TestTools;
7+
8+
public class PlayerTests
9+
{
10+
private TopdownCharacterController player;
11+
12+
[SetUp]
13+
public void Setup()
14+
{
15+
SceneManager.LoadScene("Overworld", LoadSceneMode.Single);
16+
}
17+
18+
[TearDown]
19+
public void Teardown()
20+
{
21+
if (player)
22+
Object.Destroy(player.gameObject);
23+
}
24+
25+
[UnityTest]
26+
public IEnumerator PlayerIsNotNull()
27+
{
28+
var playerObj = GameObject.Find("Player");
29+
Assert.IsNotNull(playerObj);
30+
31+
player = playerObj.GetComponent<TopdownCharacterController>();
32+
Assert.IsNotNull(player);
33+
34+
yield return null;
35+
}
36+
37+
[UnityTest]
38+
public IEnumerator PlayerMovesCorrectly()
39+
{
40+
// Calls the previous test to get the player script and ensure it's
41+
// not null before running checks on it.
42+
PlayerIsNotNull();
43+
44+
Assert.IsFalse(player.TilebasedMovement);
45+
Assert.IsFalse(player.DiagonalMovementAllowed);
46+
Assert.AreEqual(player.TimeToMaxSpeed, 0.0f);
47+
Assert.AreEqual(player.TimeToFullStop, 0.0f);
48+
49+
yield return null;
50+
}
51+
}
52+

Assets/GameTests/PlayerTests.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scenes/Overworld.unity

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!29 &1
4+
OcclusionCullingSettings:
5+
m_ObjectHideFlags: 0
6+
serializedVersion: 2
7+
m_OcclusionBakeSettings:
8+
smallestOccluder: 5
9+
smallestHole: 0.25
10+
backfaceThreshold: 100
11+
m_SceneGUID: 00000000000000000000000000000000
12+
m_OcclusionCullingData: {fileID: 0}
13+
--- !u!104 &2
14+
RenderSettings:
15+
m_ObjectHideFlags: 0
16+
serializedVersion: 9
17+
m_Fog: 0
18+
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19+
m_FogMode: 3
20+
m_FogDensity: 0.01
21+
m_LinearFogStart: 0
22+
m_LinearFogEnd: 300
23+
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24+
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25+
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26+
m_AmbientIntensity: 1
27+
m_AmbientMode: 3
28+
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
29+
m_SkyboxMaterial: {fileID: 0}
30+
m_HaloStrength: 0.5
31+
m_FlareStrength: 1
32+
m_FlareFadeSpeed: 3
33+
m_HaloTexture: {fileID: 0}
34+
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
35+
m_DefaultReflectionMode: 0
36+
m_DefaultReflectionResolution: 128
37+
m_ReflectionBounces: 1
38+
m_ReflectionIntensity: 1
39+
m_CustomReflection: {fileID: 0}
40+
m_Sun: {fileID: 0}
41+
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
42+
m_UseRadianceAmbientProbe: 0
43+
--- !u!157 &3
44+
LightmapSettings:
45+
m_ObjectHideFlags: 0
46+
serializedVersion: 11
47+
m_GIWorkflowMode: 1
48+
m_GISettings:
49+
serializedVersion: 2
50+
m_BounceScale: 1
51+
m_IndirectOutputScale: 1
52+
m_AlbedoBoost: 1
53+
m_EnvironmentLightingMode: 0
54+
m_EnableBakedLightmaps: 0
55+
m_EnableRealtimeLightmaps: 0
56+
m_LightmapEditorSettings:
57+
serializedVersion: 12
58+
m_Resolution: 2
59+
m_BakeResolution: 40
60+
m_AtlasSize: 1024
61+
m_AO: 0
62+
m_AOMaxDistance: 1
63+
m_CompAOExponent: 1
64+
m_CompAOExponentDirect: 0
65+
m_ExtractAmbientOcclusion: 0
66+
m_Padding: 2
67+
m_LightmapParameters: {fileID: 0}
68+
m_LightmapsBakeMode: 1
69+
m_TextureCompression: 1
70+
m_FinalGather: 0
71+
m_FinalGatherFiltering: 1
72+
m_FinalGatherRayCount: 256
73+
m_ReflectionCompression: 2
74+
m_MixedBakeMode: 2
75+
m_BakeBackend: 1
76+
m_PVRSampling: 1
77+
m_PVRDirectSampleCount: 32
78+
m_PVRSampleCount: 512
79+
m_PVRBounces: 2
80+
m_PVREnvironmentSampleCount: 256
81+
m_PVREnvironmentReferencePointCount: 2048
82+
m_PVRFilteringMode: 1
83+
m_PVRDenoiserTypeDirect: 1
84+
m_PVRDenoiserTypeIndirect: 1
85+
m_PVRDenoiserTypeAO: 1
86+
m_PVRFilterTypeDirect: 0
87+
m_PVRFilterTypeIndirect: 0
88+
m_PVRFilterTypeAO: 0
89+
m_PVREnvironmentMIS: 1
90+
m_PVRCulling: 1
91+
m_PVRFilteringGaussRadiusDirect: 1
92+
m_PVRFilteringGaussRadiusIndirect: 5
93+
m_PVRFilteringGaussRadiusAO: 2
94+
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
95+
m_PVRFilteringAtrousPositionSigmaIndirect: 2
96+
m_PVRFilteringAtrousPositionSigmaAO: 1
97+
m_ExportTrainingData: 0
98+
m_TrainingDataDestination: TrainingData
99+
m_LightProbeSampleCountMultiplier: 4
100+
m_LightingDataAsset: {fileID: 0}
101+
m_UseShadowmask: 1
102+
--- !u!196 &4
103+
NavMeshSettings:
104+
serializedVersion: 2
105+
m_ObjectHideFlags: 0
106+
m_BuildSettings:
107+
serializedVersion: 2
108+
agentTypeID: 0
109+
agentRadius: 0.5
110+
agentHeight: 2
111+
agentSlope: 45
112+
agentClimb: 0.4
113+
ledgeDropHeight: 0
114+
maxJumpAcrossDistance: 0
115+
minRegionArea: 2
116+
manualCellSize: 0
117+
cellSize: 0.16666667
118+
manualTileSize: 0
119+
tileSize: 256
120+
accuratePlacement: 0
121+
debug:
122+
m_Flags: 0
123+
m_NavMeshData: {fileID: 0}
124+
--- !u!1 &146270864
125+
GameObject:
126+
m_ObjectHideFlags: 0
127+
m_CorrespondingSourceObject: {fileID: 0}
128+
m_PrefabInstance: {fileID: 0}
129+
m_PrefabAsset: {fileID: 0}
130+
serializedVersion: 6
131+
m_Component:
132+
- component: {fileID: 146270867}
133+
- component: {fileID: 146270866}
134+
- component: {fileID: 146270865}
135+
m_Layer: 0
136+
m_Name: Main Camera
137+
m_TagString: MainCamera
138+
m_Icon: {fileID: 0}
139+
m_NavMeshLayer: 0
140+
m_StaticEditorFlags: 0
141+
m_IsActive: 1
142+
--- !u!81 &146270865
143+
AudioListener:
144+
m_ObjectHideFlags: 0
145+
m_CorrespondingSourceObject: {fileID: 0}
146+
m_PrefabInstance: {fileID: 0}
147+
m_PrefabAsset: {fileID: 0}
148+
m_GameObject: {fileID: 146270864}
149+
m_Enabled: 1
150+
--- !u!20 &146270866
151+
Camera:
152+
m_ObjectHideFlags: 0
153+
m_CorrespondingSourceObject: {fileID: 0}
154+
m_PrefabInstance: {fileID: 0}
155+
m_PrefabAsset: {fileID: 0}
156+
m_GameObject: {fileID: 146270864}
157+
m_Enabled: 1
158+
serializedVersion: 2
159+
m_ClearFlags: 1
160+
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
161+
m_projectionMatrixMode: 1
162+
m_GateFitMode: 2
163+
m_FOVAxisMode: 0
164+
m_SensorSize: {x: 36, y: 24}
165+
m_LensShift: {x: 0, y: 0}
166+
m_FocalLength: 50
167+
m_NormalizedViewPortRect:
168+
serializedVersion: 2
169+
x: 0
170+
y: 0
171+
width: 1
172+
height: 1
173+
near clip plane: 0.3
174+
far clip plane: 1000
175+
field of view: 60
176+
orthographic: 1
177+
orthographic size: 5
178+
m_Depth: -1
179+
m_CullingMask:
180+
serializedVersion: 2
181+
m_Bits: 4294967295
182+
m_RenderingPath: -1
183+
m_TargetTexture: {fileID: 0}
184+
m_TargetDisplay: 0
185+
m_TargetEye: 3
186+
m_HDR: 1
187+
m_AllowMSAA: 1
188+
m_AllowDynamicResolution: 0
189+
m_ForceIntoRT: 0
190+
m_OcclusionCulling: 1
191+
m_StereoConvergence: 10
192+
m_StereoSeparation: 0.022
193+
--- !u!4 &146270867
194+
Transform:
195+
m_ObjectHideFlags: 0
196+
m_CorrespondingSourceObject: {fileID: 0}
197+
m_PrefabInstance: {fileID: 0}
198+
m_PrefabAsset: {fileID: 0}
199+
m_GameObject: {fileID: 146270864}
200+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
201+
m_LocalPosition: {x: 0, y: 0, z: -10}
202+
m_LocalScale: {x: 1, y: 1, z: 1}
203+
m_Children: []
204+
m_Father: {fileID: 0}
205+
m_RootOrder: 0
206+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
207+
--- !u!1001 &211138115
208+
PrefabInstance:
209+
m_ObjectHideFlags: 0
210+
serializedVersion: 2
211+
m_Modification:
212+
m_TransformParent: {fileID: 0}
213+
m_Modifications:
214+
- target: {fileID: 1590756327094295972, guid: 30f37926d62f56143b7c78120f5ace8a,
215+
type: 3}
216+
propertyPath: _diagonalMovementAllowed
217+
value: 0
218+
objectReference: {fileID: 0}
219+
- target: {fileID: 1590756327094295973, guid: 30f37926d62f56143b7c78120f5ace8a,
220+
type: 3}
221+
propertyPath: m_Name
222+
value: Player
223+
objectReference: {fileID: 0}
224+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
225+
type: 3}
226+
propertyPath: m_RootOrder
227+
value: 1
228+
objectReference: {fileID: 0}
229+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
230+
type: 3}
231+
propertyPath: m_LocalPosition.x
232+
value: 0
233+
objectReference: {fileID: 0}
234+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
235+
type: 3}
236+
propertyPath: m_LocalPosition.y
237+
value: 0
238+
objectReference: {fileID: 0}
239+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
240+
type: 3}
241+
propertyPath: m_LocalPosition.z
242+
value: 0
243+
objectReference: {fileID: 0}
244+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
245+
type: 3}
246+
propertyPath: m_LocalRotation.w
247+
value: 1
248+
objectReference: {fileID: 0}
249+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
250+
type: 3}
251+
propertyPath: m_LocalRotation.x
252+
value: 0
253+
objectReference: {fileID: 0}
254+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
255+
type: 3}
256+
propertyPath: m_LocalRotation.y
257+
value: 0
258+
objectReference: {fileID: 0}
259+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
260+
type: 3}
261+
propertyPath: m_LocalRotation.z
262+
value: 0
263+
objectReference: {fileID: 0}
264+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
265+
type: 3}
266+
propertyPath: m_LocalEulerAnglesHint.x
267+
value: 0
268+
objectReference: {fileID: 0}
269+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
270+
type: 3}
271+
propertyPath: m_LocalEulerAnglesHint.y
272+
value: 0
273+
objectReference: {fileID: 0}
274+
- target: {fileID: 1590756327094295977, guid: 30f37926d62f56143b7c78120f5ace8a,
275+
type: 3}
276+
propertyPath: m_LocalEulerAnglesHint.z
277+
value: 0
278+
objectReference: {fileID: 0}
279+
m_RemovedComponents: []
280+
m_SourcePrefab: {fileID: 100100000, guid: 30f37926d62f56143b7c78120f5ace8a, type: 3}
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)