diff --git a/Assets/Animation/GameOverClip.anim b/Assets/Animation/GameOverClip.anim index 2cfd717aaea33947257cc08a41e243ef5c470cf7..ad0d11cb15beb777430f6850b21a7b01c89350c3 100644 --- a/Assets/Animation/GameOverClip.anim +++ b/Assets/Animation/GameOverClip.anim @@ -229,6 +229,40 @@ AnimationClip: m_PostInfinity: 2 m_RotationOrder: 4 path: MenuButton + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: 0, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.33333334 + value: {x: 1, y: 1, z: 1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 15 + value: {x: 1, y: 1, z: 1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: InGameStatisticsText m_FloatCurves: - serializedVersion: 2 curve: @@ -470,66 +504,6 @@ AnimationClip: classID: 114 script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} flags: 16 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 70 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.2 - value: 70 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.95 - value: 15 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_AnchoredPosition.y - path: CountdownText - classID: 224 - script: {fileID: 0} - flags: 0 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_AnchoredPosition.x - path: CountdownText - classID: 224 - script: {fileID: 0} - flags: 0 - serializedVersion: 2 curve: serializedVersion: 2 @@ -980,179 +954,407 @@ AnimationClip: classID: 1 script: {fileID: 0} flags: 16 - m_PPtrCurves: [] - m_SampleRate: 60 - m_WrapMode: 0 - m_Bounds: - m_Center: {x: 0, y: 0, z: 0} - m_Extent: {x: 0, y: 0, z: 0} - m_ClipBindingConstant: - genericBindings: - - serializedVersion: 2 - path: 2185909552 - attribute: 3 - script: {fileID: 0} - typeID: 4 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 596210011 - attribute: 3 - script: {fileID: 0} - typeID: 4 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 459710920 - attribute: 3 - script: {fileID: 0} - typeID: 4 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 3472888982 - attribute: 3 - script: {fileID: 0} - typeID: 4 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 152084987 - attribute: 3 - script: {fileID: 0} - typeID: 4 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 1768121632 - attribute: 3 - script: {fileID: 0} - typeID: 4 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 2185909552 - attribute: 304273561 - script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - typeID: 114 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 2689805535 - attribute: 2526845255 - script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - typeID: 114 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 2689805535 - attribute: 4215373228 - script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - typeID: 114 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 2689805535 - attribute: 2334886179 - script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - typeID: 114 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 2689805535 - attribute: 304273561 - script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - typeID: 114 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 459710920 - attribute: 538195251 - script: {fileID: 0} - typeID: 224 - customType: 28 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 2376362178 - attribute: 3305885265 - script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - typeID: 114 - customType: 24 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 459710920 - attribute: 3305885265 - script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - typeID: 114 - customType: 24 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 459710920 - attribute: 304273561 - script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - typeID: 114 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 3472888982 - attribute: 304273561 - script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - typeID: 114 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 152084987 - attribute: 304273561 - script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - typeID: 114 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 2546394416 - attribute: 4185109675 - script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} - typeID: 114 - customType: 0 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 1768121632 - attribute: 304273561 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Enabled + path: ScoreText + classID: 114 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Enabled + path: TextInput/Text (Legacy) + classID: 114 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Enabled + path: TextInput/Placeholder + classID: 114 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.25 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Enabled + path: TextInput + classID: 114 + script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1.25 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Enabled + path: TextInput + classID: 114 + script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Enabled + path: StatisticsText + classID: 114 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Enabled + path: InGameStatisticsText + classID: 114 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + flags: 16 + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 2185909552 + attribute: 3 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 596210011 + attribute: 3 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 459710920 + attribute: 3 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3472888982 + attribute: 3 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 152084987 + attribute: 3 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1768121632 + attribute: 3 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1461585792 + attribute: 3 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2185909552 + attribute: 304273561 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + typeID: 114 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2689805535 + attribute: 2526845255 + script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + typeID: 114 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2689805535 + attribute: 4215373228 + script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + typeID: 114 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2689805535 + attribute: 2334886179 + script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + typeID: 114 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2689805535 + attribute: 304273561 + script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + typeID: 114 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2376362178 + attribute: 3305885265 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + typeID: 114 + customType: 24 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 459710920 + attribute: 3305885265 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + typeID: 114 + customType: 24 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 459710920 + attribute: 304273561 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + typeID: 114 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3472888982 + attribute: 304273561 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + typeID: 114 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 152084987 + attribute: 304273561 + script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + typeID: 114 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2546394416 + attribute: 4185109675 + script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + typeID: 114 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1768121632 + attribute: 304273561 script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} typeID: 114 customType: 0 @@ -1231,6 +1433,69 @@ AnimationClip: isPPtrCurve: 0 isIntCurve: 0 isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 596210011 + attribute: 3305885265 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + typeID: 114 + customType: 24 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 2816301458 + attribute: 3305885265 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + typeID: 114 + customType: 24 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 510603249 + attribute: 3305885265 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + typeID: 114 + customType: 24 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3242430814 + attribute: 3305885265 + script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} + typeID: 114 + customType: 24 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 3242430814 + attribute: 3305885265 + script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + typeID: 114 + customType: 24 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1436022397 + attribute: 3305885265 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + typeID: 114 + customType: 24 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 1461585792 + attribute: 3305885265 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + typeID: 114 + customType: 24 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 - serializedVersion: 2 path: 2185909552 attribute: 2526845255 @@ -1258,15 +1523,6 @@ AnimationClip: isPPtrCurve: 0 isIntCurve: 0 isSerializeReferenceCurve: 0 - - serializedVersion: 2 - path: 459710920 - attribute: 1460864421 - script: {fileID: 0} - typeID: 224 - customType: 28 - isPPtrCurve: 0 - isIntCurve: 0 - isSerializeReferenceCurve: 0 pptrCurveMapping: [] m_AnimationClipSettings: serializedVersion: 2 @@ -1676,126 +1932,66 @@ AnimationClip: classID: 224 script: {fileID: 0} flags: 16 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 1 - inSlope: -0.39973345 - outSlope: -0.39973345 - tangentMode: 34 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.50016665 - value: 0.80006665 - inSlope: -0.39973345 - outSlope: -0.39973345 - tangentMode: 34 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalScale.y - path: ScoreText - classID: 224 - script: {fileID: 0} - flags: 16 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 1 - inSlope: -0.39973345 - outSlope: -0.39973345 - tangentMode: 34 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.50016665 - value: 0.80006665 - inSlope: -0.39973345 - outSlope: -0.39973345 - tangentMode: 34 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - attribute: m_LocalScale.z - path: ScoreText - classID: 224 - script: {fileID: 0} - flags: 16 - - serializedVersion: 2 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 70 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: - serializedVersion: 3 - time: 0.2 - value: 70 - inSlope: 0 - outSlope: 0 - tangentMode: 136 + time: 0 + value: 1 + inSlope: -0.39973345 + outSlope: -0.39973345 + tangentMode: 34 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 - serializedVersion: 3 - time: 0.95 - value: 15 - inSlope: 0 - outSlope: 0 - tangentMode: 136 + time: 0.50016665 + value: 0.80006665 + inSlope: -0.39973345 + outSlope: -0.39973345 + tangentMode: 34 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - attribute: m_AnchoredPosition.y - path: CountdownText + attribute: m_LocalScale.y + path: ScoreText classID: 224 script: {fileID: 0} - flags: 0 + flags: 16 - serializedVersion: 2 curve: serializedVersion: 2 m_Curve: - serializedVersion: 3 time: 0 - value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 136 + value: 1 + inSlope: -0.39973345 + outSlope: -0.39973345 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.50016665 + value: 0.80006665 + inSlope: -0.39973345 + outSlope: -0.39973345 + tangentMode: 34 weightedMode: 0 inWeight: 0.33333334 outWeight: 0.33333334 m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - attribute: m_AnchoredPosition.x - path: CountdownText + attribute: m_LocalScale.z + path: ScoreText classID: 224 script: {fileID: 0} - flags: 0 + flags: 16 - serializedVersion: 2 curve: serializedVersion: 2 @@ -2514,20 +2710,230 @@ AnimationClip: - serializedVersion: 3 time: 15 value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.y + path: MenuButton + classID: 224 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.5 + value: 1.1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.75 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.z + path: MenuButton + classID: 224 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: MenuButton + classID: 1 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: PlayButton + classID: 1 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Enabled + path: QuestText + classID: 114 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Enabled + path: + classID: 114 + script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Enabled + path: PauseButton + classID: 114 + script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 + inWeight: 0 + outWeight: 0 m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - attribute: m_LocalScale.y - path: MenuButton - classID: 224 - script: {fileID: 0} - flags: 0 + attribute: m_Enabled + path: PauseButton + classID: 114 + script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + flags: 16 - serializedVersion: 2 curve: serializedVersion: 2 @@ -2535,53 +2941,44 @@ AnimationClip: - serializedVersion: 3 time: 0 value: 0 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.5 - value: 1.1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 - weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 - - serializedVersion: 3 - time: 0.75 - value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 + inWeight: 0 + outWeight: 0 - serializedVersion: 3 time: 15 value: 1 - inSlope: 0 - outSlope: 0 - tangentMode: 136 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 weightedMode: 0 - inWeight: 0.33333334 - outWeight: 0.33333334 + inWeight: 0 + outWeight: 0 m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - attribute: m_LocalScale.z - path: MenuButton - classID: 224 + attribute: m_IsActive + path: PauseButton + classID: 1 script: {fileID: 0} - flags: 0 + flags: 16 - serializedVersion: 2 curve: serializedVersion: 2 m_Curve: - serializedVersion: 3 time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 value: 1 inSlope: Infinity outSlope: Infinity @@ -2592,17 +2989,26 @@ AnimationClip: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - attribute: m_IsActive - path: MenuButton - classID: 1 - script: {fileID: 0} - flags: 0 + attribute: m_Enabled + path: ScoreText + classID: 114 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + flags: 16 - serializedVersion: 2 curve: serializedVersion: 2 m_Curve: - serializedVersion: 3 time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 15 value: 1 inSlope: Infinity outSlope: Infinity @@ -2613,11 +3019,11 @@ AnimationClip: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - attribute: m_IsActive - path: PlayButton - classID: 1 - script: {fileID: 0} - flags: 0 + attribute: m_Enabled + path: TextInput/Text (Legacy) + classID: 114 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + flags: 16 - serializedVersion: 2 curve: serializedVersion: 2 @@ -2644,7 +3050,7 @@ AnimationClip: m_PostInfinity: 2 m_RotationOrder: 4 attribute: m_Enabled - path: QuestText + path: TextInput/Placeholder classID: 114 script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} flags: 16 @@ -2661,6 +3067,15 @@ AnimationClip: weightedMode: 0 inWeight: 0 outWeight: 0 + - serializedVersion: 3 + time: 1.25 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 - serializedVersion: 3 time: 15 value: 1 @@ -2674,10 +3089,10 @@ AnimationClip: m_PostInfinity: 2 m_RotationOrder: 4 attribute: m_Enabled - path: + path: TextInput classID: 114 - script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - flags: 0 + script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} + flags: 16 - serializedVersion: 2 curve: serializedVersion: 2 @@ -2691,6 +3106,15 @@ AnimationClip: weightedMode: 0 inWeight: 0 outWeight: 0 + - serializedVersion: 3 + time: 1.25 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 - serializedVersion: 3 time: 15 value: 1 @@ -2704,9 +3128,9 @@ AnimationClip: m_PostInfinity: 2 m_RotationOrder: 4 attribute: m_Enabled - path: PauseButton + path: TextInput classID: 114 - script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} flags: 16 - serializedVersion: 2 curve: @@ -2734,9 +3158,9 @@ AnimationClip: m_PostInfinity: 2 m_RotationOrder: 4 attribute: m_Enabled - path: PauseButton + path: StatisticsText classID: 114 - script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} flags: 16 - serializedVersion: 2 curve: @@ -2744,7 +3168,7 @@ AnimationClip: m_Curve: - serializedVersion: 3 time: 0 - value: 0 + value: 1 inSlope: Infinity outSlope: Infinity tangentMode: 103 @@ -2753,7 +3177,7 @@ AnimationClip: outWeight: 0 - serializedVersion: 3 time: 15 - value: 1 + value: 0 inSlope: Infinity outSlope: Infinity tangentMode: 103 @@ -2763,11 +3187,128 @@ AnimationClip: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 - attribute: m_IsActive - path: PauseButton - classID: 1 - script: {fileID: 0} + attribute: m_Enabled + path: InGameStatisticsText + classID: 114 + script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} flags: 16 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.x + path: InGameStatisticsText + classID: 224 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.y + path: InGameStatisticsText + classID: 224 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.33333334 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 15 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.z + path: InGameStatisticsText + classID: 224 + script: {fileID: 0} + flags: 0 m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 21efa6cffba90725a0bfb59400803383953108f6..973615d5faef3635987c36a9d76915b4d2c63a90 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 8900000, guid: a7bed68887a07e34394d4191b3081359, type: 3} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.1000388, g: 0.11809564, b: 0.11640024, a: 1} + m_IndirectSpecularColor: {r: 0.100039154, g: 0.11809585, b: 0.11640041, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &4 LightmapSettings: @@ -123,6 +123,100 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &4043335 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4043336} + - component: {fileID: 4043339} + - component: {fileID: 4043338} + - component: {fileID: 4043337} + m_Layer: 5 + m_Name: InGameStatisticsText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4043336 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4043335} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1436637204} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 250, y: 200} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &4043337 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4043335} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 712c00f247ff6a146bb72ac664470118, type: 3} + m_Name: + m_EditorClassIdentifier: + statistics: {fileID: 0} +--- !u!114 &4043338 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4043335} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: 46238fb1ad7a7a84ba8954c1c860994c, type: 3} + m_FontSize: 23 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "Score: \nShots Fired: \nShots Hit: \nShot Accuracy: \nDistance Traveled:\nPlay + Time:\nEnemies Killed:" +--- !u!222 &4043339 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4043335} + m_CullTransparentMesh: 1 --- !u!1 &28357257 GameObject: m_ObjectHideFlags: 0 @@ -2133,6 +2227,99 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 75, y: 60} m_Pivot: {x: 0, y: 0} +--- !u!1 &598748822 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 598748823} + - component: {fileID: 598748826} + - component: {fileID: 598748825} + - component: {fileID: 598748824} + m_Layer: 5 + m_Name: StatisticsText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &598748823 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598748822} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1436637204} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 300, y: -210} + m_SizeDelta: {x: 200, y: 200} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &598748824 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598748822} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cc69dcba98fc3554b93340e3297c3255, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &598748825 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598748822} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "Shots Fired: \nShots Hit: \nShot Accuracy: \nDistance Traveled:\nPlay + Time:\nHigh Score:\nAll Time Score: \nEnemies Killed:" +--- !u!222 &598748826 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598748822} + m_CullTransparentMesh: 1 --- !u!1 &664994689 GameObject: m_ObjectHideFlags: 0 @@ -3219,7 +3406,7 @@ MonoBehaviour: m_fontMaterials: [] m_fontColor32: serializedVersion: 2 - rgba: 16777215 + rgba: 4294967295 m_fontColor: {r: 1, g: 1, b: 1, a: 0} m_enableVertexGradient: 0 m_colorMode: 3 @@ -3391,7 +3578,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -133, y: -122} + m_AnchoredPosition: {x: -133, y: -172} m_SizeDelta: {x: 218, y: 60} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1172229237 @@ -4156,6 +4343,8 @@ RectTransform: - {fileID: 1425175304} - {fileID: 837300818} - {fileID: 1394265173} + - {fileID: 598748823} + - {fileID: 4043336} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -4197,7 +4386,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 70} + m_AnchoredPosition: {x: 0, y: 210} m_SizeDelta: {x: 130, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1450818668 @@ -4667,7 +4856,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: -58} + m_AnchoredPosition: {x: 0, y: -108} m_SizeDelta: {x: 130, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1581133372 @@ -4803,7 +4992,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 150} m_SizeDelta: {x: 130, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!1001 &1641232233 @@ -5067,14 +5256,17 @@ PrefabInstance: - {fileID: 8455667667674168468, guid: 4e5a0d387dc27394b81600988ad0216f, type: 3} - {fileID: 100008, guid: 4e5a0d387dc27394b81600988ad0216f, type: 3} m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 100006, guid: 4e5a0d387dc27394b81600988ad0216f, type: 3} + insertIndex: -1 + addedObject: {fileID: 2023876524} m_SourcePrefab: {fileID: 100100000, guid: 4e5a0d387dc27394b81600988ad0216f, type: 3} --- !u!114 &1641232234 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 11400004, guid: 4e5a0d387dc27394b81600988ad0216f, type: 3} m_PrefabInstance: {fileID: 1641232233} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} + m_GameObject: {fileID: 1974427093} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: c32067ea884548644b13cf9baddd4573, type: 3} @@ -5221,7 +5413,7 @@ MonoBehaviour: m_fontMaterials: [] m_fontColor32: serializedVersion: 2 - rgba: 16777215 + rgba: 4294967295 m_fontColor: {r: 1, g: 1, b: 1, a: 0} m_enableVertexGradient: 0 m_colorMode: 3 @@ -5325,7 +5517,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 143, y: -122} + m_AnchoredPosition: {x: 143, y: -172} m_SizeDelta: {x: 218, y: 60} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1725686720 @@ -5855,6 +6047,8 @@ Transform: - {fileID: 461218465} - {fileID: 1222083999} - {fileID: 125324177} + - {fileID: 1951331926} + - {fileID: 2025282752} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1796129604 @@ -6498,6 +6692,56 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1948277206} m_CullTransparentMesh: 1 +--- !u!1 &1951331925 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1951331926} + - component: {fileID: 1951331927} + m_Layer: 0 + m_Name: DataPersistanceManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1951331926 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1951331925} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1796129603} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1951331927 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1951331925} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 615057aa5dd75e34383756f1bf0fa143, type: 3} + m_Name: + m_EditorClassIdentifier: + fileName: data.game +--- !u!1 &1974427093 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 100006, guid: 4e5a0d387dc27394b81600988ad0216f, type: 3} + m_PrefabInstance: {fileID: 1641232233} + m_PrefabAsset: {fileID: 0} --- !u!1 &1979757893 GameObject: m_ObjectHideFlags: 0 @@ -6589,6 +6833,63 @@ Animator: m_CorrespondingSourceObject: {fileID: 9500000, guid: 4e5a0d387dc27394b81600988ad0216f, type: 3} m_PrefabInstance: {fileID: 1641232233} m_PrefabAsset: {fileID: 0} +--- !u!114 &2023876524 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1974427093} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 472ec104c593ad9439f5dbb57bd16de6, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2025282751 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2025282752} + - component: {fileID: 2025282753} + m_Layer: 0 + m_Name: StatisticsManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2025282752 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2025282751} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1796129603} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2025282753 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2025282751} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 88721a2f76be08e449bdca94e099fa3d, type: 3} + m_Name: + m_EditorClassIdentifier: + fileNameStatistics: statistics.game --- !u!1 &2096198479 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Camera/CameraFollow.cs b/Assets/Scripts/Camera/CameraFollow.cs index e02e4fa89dec8bdb553baf29b30563fc3b4abe0e..5e3ebe8d79067eb4752772ed47092ab68f77b7d0 100644 --- a/Assets/Scripts/Camera/CameraFollow.cs +++ b/Assets/Scripts/Camera/CameraFollow.cs @@ -3,7 +3,7 @@ using System.Collections; namespace Nightmare { - public class CameraFollow : MonoBehaviour + public class CameraFollow : MonoBehaviour, IDataPersistance { public Transform target; // The position that that camera will be following. public float smoothing = 5f; // The speed with which the camera will be following. @@ -24,5 +24,19 @@ namespace Nightmare // Smoothly interpolate between the camera's current position and it's target position. transform.position = Vector3.Lerp (transform.position, targetCamPos, smoothing * Time.deltaTime); } + + public void LoadData(GameData data) + { + if (data.cameraPosition != Vector3.zero) + { + this.transform.position = data.cameraPosition; + } + } + + public void SaveData(ref GameData data) + { + data.cameraPosition = this.transform.position; + } + } } \ No newline at end of file diff --git a/Assets/Scripts/Camera/CameraPosition.cs b/Assets/Scripts/Camera/CameraPosition.cs new file mode 100644 index 0000000000000000000000000000000000000000..d663007ef8c1f56b52b799fd5486e107b8c81097 --- /dev/null +++ b/Assets/Scripts/Camera/CameraPosition.cs @@ -0,0 +1,27 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CameraPosition : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + //public void LoadData(GameData data) + //{ + // this.transform.position = data.cameraPosition; + //} + + //public void SaveData(ref GameData data) + //{ + // data.cameraPosition = this.transform.position; + //} +} diff --git a/Assets/Scripts/Camera/CameraPosition.cs.meta b/Assets/Scripts/Camera/CameraPosition.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..96dd0796cd9eb15dd49e9f7494933b7ff209614a --- /dev/null +++ b/Assets/Scripts/Camera/CameraPosition.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0bb2d3419e085b341a2beb50ff4e439c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DataPersistance.meta b/Assets/Scripts/DataPersistance.meta new file mode 100644 index 0000000000000000000000000000000000000000..3611194e1c3f721f59f4192bcd9fdf4216e494eb --- /dev/null +++ b/Assets/Scripts/DataPersistance.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ac1bd35b15d13ef4fb007d122c07c9f1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DataPersistance/Data.meta b/Assets/Scripts/DataPersistance/Data.meta new file mode 100644 index 0000000000000000000000000000000000000000..1d35b95264c17368cbc36032a0cc295b5ddd96b9 --- /dev/null +++ b/Assets/Scripts/DataPersistance/Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bca084b46d9a8cd49b51558777d4da2d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DataPersistance/Data/GameData.cs b/Assets/Scripts/DataPersistance/Data/GameData.cs new file mode 100644 index 0000000000000000000000000000000000000000..ad5baf5415b2057622bca3960f652af62e08c1ce --- /dev/null +++ b/Assets/Scripts/DataPersistance/Data/GameData.cs @@ -0,0 +1,43 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +[System.Serializable] + +public class GameData +{ + // public int timer; + public int playerHealth; + public float damagePercent; + + public Vector3 playerPosition; + public Vector3 cameraPosition; + + public int score; + public int shotsFired; + public int shotsHit; + public double shotAccuracy; + public double distanceTraveled; + public double playTime; + public int highScore; + public int allTimeScore; + public int enemiesKilled; + + + public GameData() + { + this.playerHealth = 100; + this.damagePercent = 1; + this.playerPosition = Vector3.zero; + this.cameraPosition = Vector3.zero; + + // Statistics + this.score = 0; + this.shotsFired = 0; + this.shotsHit = 0; + this.shotAccuracy = 0; + this.distanceTraveled = 0; + this.playTime = 0; + this.enemiesKilled = 0; + } +} \ No newline at end of file diff --git a/Assets/Scripts/DataPersistance/Data/GameData.cs.meta b/Assets/Scripts/DataPersistance/Data/GameData.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..8713687b4764ac4d6d29c9883468efb07446463e --- /dev/null +++ b/Assets/Scripts/DataPersistance/Data/GameData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: efb9228d2119b7c4094048f380084902 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DataPersistance/DataPersistanceManager.cs b/Assets/Scripts/DataPersistance/DataPersistanceManager.cs new file mode 100644 index 0000000000000000000000000000000000000000..9944b64235eea2b349141c6818b47696e87263cf --- /dev/null +++ b/Assets/Scripts/DataPersistance/DataPersistanceManager.cs @@ -0,0 +1,85 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System.Linq; + +public class DataPersistanceManager : MonoBehaviour +{ + [Header("File Storage Config")] + [SerializeField] private string fileName; + + private GameData gameData; + + private List<IDataPersistance> dataPersistanceObjects; + private FileDataHandler dataHandler; + + + public static DataPersistanceManager instance { get; private set; } + + + public void Awake() + { + if (instance != null) + { + Debug.LogError("Found more than one Data Persistance Manager in the scene."); + } + instance = this; + } + + private void Start() + { + this.dataHandler = new FileDataHandler(Application.persistentDataPath, fileName); + this.dataPersistanceObjects = FindAllDataPersistanceObjects(); + LoadGame(); + } + + public void NewGame() + { + this.gameData = new GameData(); + } + + public void LoadGame() + { + // load any saved data form a file using the data handler + this.gameData = dataHandler.Load(); + + + // if no data can be loaded, initialize to a new game + if (this.gameData == null) + { + NewGame(); + } + + // push the loaded data to all other scipts that need it + foreach (IDataPersistance dataPersistanceObj in dataPersistanceObjects) + { + dataPersistanceObj.LoadData(gameData); + } + + } + public void SaveGame() + { + // pass the data to other scripts so they can update it + foreach (IDataPersistance dataPersistanceObj in dataPersistanceObjects) + { + dataPersistanceObj.SaveData(ref gameData); + } + + // save that data to a file using the data handler + dataHandler.Save(gameData); + } + + private void OnApplicationQuit() + { + SaveGame(); + } + + private List<IDataPersistance> FindAllDataPersistanceObjects() + { + IEnumerable<IDataPersistance> dataPersistanceObjects = FindObjectsOfType<MonoBehaviour>() + .OfType<IDataPersistance>(); + + return new List<IDataPersistance>(dataPersistanceObjects); + } + +} diff --git a/Assets/Scripts/DataPersistance/DataPersistanceManager.cs.meta b/Assets/Scripts/DataPersistance/DataPersistanceManager.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..42be37d44c359c54f909155bf75338b95915d2aa --- /dev/null +++ b/Assets/Scripts/DataPersistance/DataPersistanceManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 615057aa5dd75e34383756f1bf0fa143 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DataPersistance/FileDataHandler.cs b/Assets/Scripts/DataPersistance/FileDataHandler.cs new file mode 100644 index 0000000000000000000000000000000000000000..4a3ae761e6d6e566603eb9252855ba4074ef3629 --- /dev/null +++ b/Assets/Scripts/DataPersistance/FileDataHandler.cs @@ -0,0 +1,78 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +using System.IO; + + +public class FileDataHandler +{ + private string dataDirPath = ""; + private string dataFileName = ""; + + + public FileDataHandler(string dataDirPath, string dataFileName) + { + this.dataDirPath = dataDirPath; + this.dataFileName = dataFileName; + } + + + public GameData Load() + { + // use Path.Combine to account for different OS's having different path separators + string fullPath = Path.Combine(dataDirPath, dataFileName); + GameData loadedData = null; + if (File.Exists(fullPath)) + { + try + { + // load the serialized data from the file + string dataToLoad = ""; + using (FileStream stream = new FileStream(fullPath, FileMode.Open)) + { + using (StreamReader reader = new StreamReader(stream)) + { + dataToLoad = reader.ReadToEnd(); + } + } + + // deserialize the data from Json back nto the C# object + loadedData = JsonUtility.FromJson<GameData>(dataToLoad); + + } + catch (Exception e) + { + Debug.LogError("Error occured when trying to load data from file: " + fullPath + "\n" + e); + } + } + return loadedData; + } + + public void Save(GameData data) + { + string fullPath = Path.Combine(dataDirPath, dataFileName); + + try + { + // create the directory the file will be written to if it doesn't already exist + Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); + + // serialize the C# game data object into Json + string dataToStore = JsonUtility.ToJson(data, true); + + // write the serialized data to the file + using (FileStream stream = new FileStream(fullPath, FileMode.Create)) + { + using (StreamWriter writer = new StreamWriter(stream)) + { + writer.Write(dataToStore); + } + } + } + catch (Exception e) + { + Debug.LogError("Error occured when trying to save data to file: " + fullPath + "\n" + e); + } + } +} diff --git a/Assets/Scripts/DataPersistance/FileDataHandler.cs.meta b/Assets/Scripts/DataPersistance/FileDataHandler.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..6bf17df1d55264adad0d003dffab7b4299dc22bc --- /dev/null +++ b/Assets/Scripts/DataPersistance/FileDataHandler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 820333adc13c5f64393c79a333c62618 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DataPersistance/IDataPersistance.cs b/Assets/Scripts/DataPersistance/IDataPersistance.cs new file mode 100644 index 0000000000000000000000000000000000000000..43475cc50375ab3040a9403a1bda53d2e447c2b5 --- /dev/null +++ b/Assets/Scripts/DataPersistance/IDataPersistance.cs @@ -0,0 +1,10 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public interface IDataPersistance +{ + void LoadData(GameData data); + + void SaveData(ref GameData data); +} diff --git a/Assets/Scripts/DataPersistance/IDataPersistance.cs.meta b/Assets/Scripts/DataPersistance/IDataPersistance.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..a13d1a7d01a2854ace2a70d4e0347169a412bfca --- /dev/null +++ b/Assets/Scripts/DataPersistance/IDataPersistance.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 54ff2aac833878f4a8a190d6294c45fd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Enemy/EnemyHealth.cs b/Assets/Scripts/Enemy/EnemyHealth.cs index 726b12e915eb9e2369a4cef891290a05741e783e..ab809be19b7dadd94d2d3fdf85475cb71009fdda 100644 --- a/Assets/Scripts/Enemy/EnemyHealth.cs +++ b/Assets/Scripts/Enemy/EnemyHealth.cs @@ -25,12 +25,12 @@ namespace Nightmare public GameObject restoreHealthOrbPrefab; // Restore Health Orb public GameObject increaseSpeedOrbPrefab; // Increase Speed Orb - void Awake () + void Awake() { - anim = GetComponent <Animator> (); - enemyAudio = GetComponent <AudioSource> (); - hitParticles = GetComponentInChildren <ParticleSystem> (); - capsuleCollider = GetComponent <CapsuleCollider> (); + anim = GetComponent<Animator>(); + enemyAudio = GetComponent<AudioSource>(); + hitParticles = GetComponentInChildren<ParticleSystem>(); + capsuleCollider = GetComponent<CapsuleCollider>(); enemyMovement = this.GetComponent<EnemyMovement>(); int difficultyLvl = PlayerPrefs.GetInt("Difficulty", 0); @@ -38,7 +38,8 @@ namespace Nightmare { startingHealth = Mathf.RoundToInt(startingHealth * 1.5f); scoreValue *= 2; - } else if (difficultyLvl == 2) + } + else if (difficultyLvl == 2) { startingHealth = Mathf.RoundToInt(startingHealth * 2f); scoreValue *= 3; @@ -57,11 +58,11 @@ namespace Nightmare capsuleCollider.attachedRigidbody.isKinematic = isKinematic; } - void Update () + void Update() { if (IsDead()) { - transform.Translate (-Vector3.up * sinkSpeed * Time.deltaTime); + transform.Translate(-Vector3.up * sinkSpeed * Time.deltaTime); if (transform.position.y < -10f) { Destroy(gameObject); @@ -74,7 +75,7 @@ namespace Nightmare return (currentHealth <= 0f); } - public void TakeDamage (int amount, Vector3 hitPoint) + public void TakeDamage(int amount, Vector3 hitPoint) { if (!IsDead()) { @@ -91,12 +92,12 @@ namespace Nightmare enemyMovement?.GoToPlayer(); } } - + hitParticles.transform.position = hitPoint; hitParticles.Play(); } - void Death () + void Death() { float orbSpawnProbability = 0.3f; // Orb Spawn Probability @@ -130,38 +131,44 @@ namespace Nightmare Debug.Log("Orb prefab is null"); } } - + EventManager.TriggerEvent("Sound", this.transform.position); - anim.SetTrigger ("Dead"); + anim.SetTrigger("Dead"); if (enemyAudio != null) { enemyAudio.clip = deathClip; - enemyAudio.Play (); + enemyAudio.Play(); } - + } - public void StartSinking () + public void StartSinking() { - GetComponent <UnityEngine.AI.NavMeshAgent> ().enabled = false; + GetComponent<UnityEngine.AI.NavMeshAgent>().enabled = false; SetKinematics(true); - - ScoreManager.score += scoreValue; + InGameTextStatistics.score += scoreValue; + TextStatistics.allTimeScore += scoreValue; if (type == enemyTypes.Keroco) { QuestManager.kerocoCount++; - } else if (type == enemyTypes.Kepala) + } + else if (type == enemyTypes.Kepala) { QuestManager.kepalaCount++; - } else if (type == enemyTypes.Jenderal) + } + else if (type == enemyTypes.Jenderal) { QuestManager.jenderalCount++; - } else + } + else { QuestManager.rajaCount++; } + TextStatistics.enemiesKilled++; + InGameTextStatistics.enemiesKilled++; + } public int CurrentHealth() diff --git a/Assets/Scripts/Managers/GameOverManager.cs b/Assets/Scripts/Managers/GameOverManager.cs index 7eadda73500997f1008e0c996cf57633ebc8a749..f89083c3a484ba6c098bddc37ed9b1217b91edff 100644 --- a/Assets/Scripts/Managers/GameOverManager.cs +++ b/Assets/Scripts/Managers/GameOverManager.cs @@ -28,7 +28,11 @@ namespace Nightmare { } private void ResetLevel() { - ScoreManager.score = 0; + // ScoreManager.score = 0; + if (InGameTextStatistics.score > TextStatistics.highScore) + { + TextStatistics.highScore = InGameTextStatistics.score; + } // lm.LoadInitialLevel(); // playerHealth.ResetPlayer(); timerManager.ResetTimer(); diff --git a/Assets/Scripts/Managers/ScoreManager.cs b/Assets/Scripts/Managers/ScoreManager.cs index f72f10f50a32d1ceafd565667ac86c957529f553..9cddb2ae5db757bdec70bb47956db7257f036b1c 100644 --- a/Assets/Scripts/Managers/ScoreManager.cs +++ b/Assets/Scripts/Managers/ScoreManager.cs @@ -12,17 +12,18 @@ namespace Nightmare Text sText; - void Awake () + void Awake() { - sText = GetComponent <Text> (); + sText = GetComponent<Text>(); score = 0; levelThreshhold = LEVEL_INCREASE; } - void Update () + void Update() { + ScoreManager.score = InGameTextStatistics.score; sText.text = "Score: " + score; } diff --git a/Assets/Scripts/Managers/TimerManager.cs b/Assets/Scripts/Managers/TimerManager.cs index 451d2bce8b96f0d36749a6c163fbbf6ee1d6035a..8c37f9ae27c4c90280ef3087efab3d75a393ae27 100644 --- a/Assets/Scripts/Managers/TimerManager.cs +++ b/Assets/Scripts/Managers/TimerManager.cs @@ -18,6 +18,8 @@ public class TimerManager : MonoBehaviour { void Update() { if (isRunning) { time = time + Time.deltaTime; + TextStatistics.playTime += Time.deltaTime; + InGameTextStatistics.playTime += Time.deltaTime; } string timeText = System.TimeSpan.FromSeconds(time).ToString("mm':'ss"); Timer.text = timeText; diff --git a/Assets/Scripts/Player/PlayerHealth.cs b/Assets/Scripts/Player/PlayerHealth.cs index 0c603cfd9f147e79593cb59a337da5c6307a2ed9..ce62ec6323b049430304b905c02c4549dcc72a8c 100644 --- a/Assets/Scripts/Player/PlayerHealth.cs +++ b/Assets/Scripts/Player/PlayerHealth.cs @@ -5,7 +5,7 @@ using UnityEngine.SceneManagement; namespace Nightmare { - public class PlayerHealth : MonoBehaviour + public class PlayerHealth : MonoBehaviour, IDataPersistance { public int startingHealth = 100; public int currentHealth; @@ -123,5 +123,17 @@ namespace Nightmare { isCheatNoDamage = isActive; } + + public void LoadData(GameData data) + { + this.currentHealth = data.playerHealth; + healthSlider.value = this.currentHealth; + } + + public void SaveData(ref GameData data) + { + data.playerHealth = this.currentHealth; + } + } } \ No newline at end of file diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 3e3c95e177a2f26b17ae77002cff50404c6f7b92..03b73eebb16e7791b3e2e1f6052892f990a4b61e 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -19,6 +19,8 @@ namespace Nightmare float camRayLength = 100f; // The length of the ray from the camera into the scene. #endif + private Vector3 lastPosition; // Variable to store the last position + void Awake () { #if !MOBILE_INPUT @@ -65,6 +67,21 @@ namespace Nightmare { // Set the movement vector based on the axis input. movement.Set (h, 0f, v); + + // Calculate the distance moved since the last frame + float distanceMoved = Vector3.Distance(transform.position, lastPosition); + + // Update the last position to the current position + lastPosition = transform.position; + + // If the distance moved is greater than a small threshold (to avoid counting tiny movements due to floating-point imprecision) + if (distanceMoved > 0.001f) + { + // Increment distanceTraveled by the distance moved + TextStatistics.distanceTraveled += distanceMoved; + InGameTextStatistics.distanceTraveled += distanceMoved; + } + // Normalise the movement vector and make it proportional to the speed per second. movement = movement.normalized * speed * Time.deltaTime; diff --git a/Assets/Scripts/Player/PlayerPosition.cs b/Assets/Scripts/Player/PlayerPosition.cs new file mode 100644 index 0000000000000000000000000000000000000000..5562906036fad64be2c57142d0f046b8a479dd37 --- /dev/null +++ b/Assets/Scripts/Player/PlayerPosition.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PlayerPosition : MonoBehaviour, IDataPersistance +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + + public void LoadData(GameData data) + { + this.transform.position = data.playerPosition; + } + + public void SaveData(ref GameData data) + { + data.playerPosition = this.transform.position; + } +} diff --git a/Assets/Scripts/Player/PlayerPosition.cs.meta b/Assets/Scripts/Player/PlayerPosition.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..156f56cddddee096d3454b076862140cbe621307 --- /dev/null +++ b/Assets/Scripts/Player/PlayerPosition.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 472ec104c593ad9439f5dbb57bd16de6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Player/PlayerShooting.cs b/Assets/Scripts/Player/PlayerShooting.cs index 1bbb2228a3e43878460e6ee35c5e5b14af857a33..f5c0eecca2be51e7787920e487e123c1aa468b6f 100644 --- a/Assets/Scripts/Player/PlayerShooting.cs +++ b/Assets/Scripts/Player/PlayerShooting.cs @@ -9,7 +9,7 @@ using UnityEngine.Playables; namespace Nightmare { - public class PlayerShooting : PausibleObject + public class PlayerShooting : PausibleObject, IDataPersistance { public GameObject grenade; public float grenadeSpeed = 200f; @@ -234,5 +234,16 @@ namespace Nightmare { damagePercent = 100000; } + + public void LoadData(GameData data) + { + data.damagePercent = this.damagePercent; + } + + public void SaveData(ref GameData data) + { + this.damagePercent = data.damagePercent; + } + } } \ No newline at end of file diff --git a/Assets/Scripts/Statistics.meta b/Assets/Scripts/Statistics.meta new file mode 100644 index 0000000000000000000000000000000000000000..b1271b57c02387ceb432606938638ae575330c0a --- /dev/null +++ b/Assets/Scripts/Statistics.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: efce739546f09ff49becd1de78c46247 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Statistics/FileStatisticsHandler.cs b/Assets/Scripts/Statistics/FileStatisticsHandler.cs new file mode 100644 index 0000000000000000000000000000000000000000..10539885e914c8afccd11c81b47e5ef8350a6a6b --- /dev/null +++ b/Assets/Scripts/Statistics/FileStatisticsHandler.cs @@ -0,0 +1,78 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +using System.IO; + + +public class FileStatisticsHandler +{ + private string dataDirPath = ""; + private string dataFileName = ""; + + + public FileStatisticsHandler(string dataDirPath, string dataFileName) + { + this.dataDirPath = dataDirPath; + this.dataFileName = dataFileName; + } + + + public StatisticsData Load() + { + // use Path.Combine to account for different OS's having different path separators + string fullPath = Path.Combine(dataDirPath, dataFileName); + StatisticsData loadedData = null; + if (File.Exists(fullPath)) + { + try + { + // load the serialized data from the file + string dataToLoad = ""; + using (FileStream stream = new FileStream(fullPath, FileMode.Open)) + { + using (StreamReader reader = new StreamReader(stream)) + { + dataToLoad = reader.ReadToEnd(); + } + } + + // deserialize the data from Json back nto the C# object + loadedData = JsonUtility.FromJson<StatisticsData>(dataToLoad); + + } + catch (Exception e) + { + Debug.LogError("Error occured when trying to load data from file: " + fullPath + "\n" + e); + } + } + return loadedData; + } + + public void Save(StatisticsData data) + { + string fullPath = Path.Combine(dataDirPath, dataFileName); + + try + { + // create the directory the file will be written to if it doesn't already exist + Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); + + // serialize the C# game data object into Json + string dataToStore = JsonUtility.ToJson(data, true); + + // write the serialized data to the file + using (FileStream stream = new FileStream(fullPath, FileMode.Create)) + { + using (StreamWriter writer = new StreamWriter(stream)) + { + writer.Write(dataToStore); + } + } + } + catch (Exception e) + { + Debug.LogError("Error occured when trying to save statistics data to file: " + fullPath + "\n" + e); + } + } +} diff --git a/Assets/Scripts/Statistics/FileStatisticsHandler.cs.meta b/Assets/Scripts/Statistics/FileStatisticsHandler.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..62f2bed85a89573f8a24b6cf5bbfff320ed6366f --- /dev/null +++ b/Assets/Scripts/Statistics/FileStatisticsHandler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7c78693f054879f47ae27834bceb4024 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Statistics/IStatisticsData.cs b/Assets/Scripts/Statistics/IStatisticsData.cs new file mode 100644 index 0000000000000000000000000000000000000000..0fb805a0ce38cd1b2355b342c39e0deb64910dc9 --- /dev/null +++ b/Assets/Scripts/Statistics/IStatisticsData.cs @@ -0,0 +1,10 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public interface IStatisticsData +{ + void LoadStatistics(StatisticsData data); + + void SaveStatistics(ref StatisticsData data); +} diff --git a/Assets/Scripts/Statistics/IStatisticsData.cs.meta b/Assets/Scripts/Statistics/IStatisticsData.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e914f0b2b72ca983a2d7d53f25fa40632933d023 --- /dev/null +++ b/Assets/Scripts/Statistics/IStatisticsData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7d75d8325e71dfe4b8421b7aacf28286 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Statistics/InGameTextStatistics.cs b/Assets/Scripts/Statistics/InGameTextStatistics.cs new file mode 100644 index 0000000000000000000000000000000000000000..2f92e80da688bb88af80fb970b890ade070310f8 --- /dev/null +++ b/Assets/Scripts/Statistics/InGameTextStatistics.cs @@ -0,0 +1,80 @@ +using System.Collections; +using System.Collections.Generic; +using Nightmare; +using UnityEngine; +using UnityEngine.UI; + + +public class InGameTextStatistics : MonoBehaviour, IDataPersistance +{ + public static int score; + public static int shotsFired; + public static int shotsHit; + public static double shotAccuracy; + public static double distanceTraveled; + public static double playTime; + public static int enemiesKilled; + + public Text statistics; + + void Awake() + { + InGameTextStatistics.score = 0; + InGameTextStatistics.shotsFired = 0; + InGameTextStatistics.shotsHit = 0; + InGameTextStatistics.shotAccuracy = 0; + InGameTextStatistics.distanceTraveled = 0; + InGameTextStatistics.playTime = 0; + InGameTextStatistics.enemiesKilled = 0; + + this.statistics = GetComponent<Text>(); + } + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + string timeText = System.TimeSpan.FromSeconds(InGameTextStatistics.playTime).ToString("mm':'ss"); + if (InGameTextStatistics.shotsFired != 0) + { + InGameTextStatistics.shotAccuracy = ((double)InGameTextStatistics.shotsHit / InGameTextStatistics.shotsFired) * 100; + } + + statistics.text = "Score: " + InGameTextStatistics.score + "\n" + + "Shots Fired: " + InGameTextStatistics.shotsFired + "\n" + + "Shots Hit: " + InGameTextStatistics.shotsHit + "\n" + + "Shot Accuracy: " + InGameTextStatistics.shotAccuracy.ToString("F2") + "%\n" + + "Distance Traveled: " + (InGameTextStatistics.distanceTraveled / 1000).ToString("F3") + "km \n" + + "Play Time: " + timeText + "\n" + + "Enemies Killed: " + InGameTextStatistics.enemiesKilled + "\n"; + } + + + public void LoadData(GameData data) + { + InGameTextStatistics.score = data.score; + InGameTextStatistics.shotsFired = data.shotsFired; + InGameTextStatistics.shotsHit = data.shotsHit; + InGameTextStatistics.shotAccuracy = data.shotAccuracy; + InGameTextStatistics.distanceTraveled = data.distanceTraveled; + InGameTextStatistics.playTime = data.playTime; + InGameTextStatistics.enemiesKilled = data.enemiesKilled; + } + + public void SaveData(ref GameData data) + { + data.score = InGameTextStatistics.score; + data.shotsFired = InGameTextStatistics.shotsFired; + data.shotsHit = InGameTextStatistics.shotsHit; + data.shotAccuracy = InGameTextStatistics.shotAccuracy; + data.distanceTraveled = InGameTextStatistics.distanceTraveled; + data.playTime = InGameTextStatistics.playTime; + data.enemiesKilled = InGameTextStatistics.enemiesKilled; + } + +} diff --git a/Assets/Scripts/Statistics/InGameTextStatistics.cs.meta b/Assets/Scripts/Statistics/InGameTextStatistics.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..74dec250223292ff86d252e4c7d1c8392eb9b4d5 --- /dev/null +++ b/Assets/Scripts/Statistics/InGameTextStatistics.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 712c00f247ff6a146bb72ac664470118 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Statistics/Statistics Data.meta b/Assets/Scripts/Statistics/Statistics Data.meta new file mode 100644 index 0000000000000000000000000000000000000000..ac30c9ffdefa352e5c31e05d7a65197098f813e2 --- /dev/null +++ b/Assets/Scripts/Statistics/Statistics Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7eaaa89ec6d929b41a1e063d28f524b2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Statistics/Statistics Data/StatisticsData.cs b/Assets/Scripts/Statistics/Statistics Data/StatisticsData.cs new file mode 100644 index 0000000000000000000000000000000000000000..3eae485ef13ff7f5b2df13348573792665e25516 --- /dev/null +++ b/Assets/Scripts/Statistics/Statistics Data/StatisticsData.cs @@ -0,0 +1,29 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +[System.Serializable] + +public class StatisticsData +{ + public int shotsFired; + public int shotsHit; + public double shotAccuracy; + public double distanceTraveled; + public double playTime; + public int highScore; + public int allTimeScore; + public int enemiesKilled; + + public StatisticsData() + { + this.shotsFired = 0; + this.shotsHit = 0; + this.shotAccuracy = 0; + this.distanceTraveled = 0; + this.playTime = 0; + this.highScore = 0; + this.allTimeScore = 0; + this.enemiesKilled = 0; + } +} diff --git a/Assets/Scripts/Statistics/Statistics Data/StatisticsData.cs.meta b/Assets/Scripts/Statistics/Statistics Data/StatisticsData.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..fb151456b0e84bdca70ac3cf5d4c7c8a28d008de --- /dev/null +++ b/Assets/Scripts/Statistics/Statistics Data/StatisticsData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3fb9b8369eaff94698ccc2a5d2de65f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Statistics/StatisticsManager.cs b/Assets/Scripts/Statistics/StatisticsManager.cs new file mode 100644 index 0000000000000000000000000000000000000000..ac668f957507178c8d3b6dd65e5a201730e655d5 --- /dev/null +++ b/Assets/Scripts/Statistics/StatisticsManager.cs @@ -0,0 +1,85 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System.Linq; + +public class StatisticsManager : MonoBehaviour +{ + [Header("File Storage Config")] + [SerializeField] private string fileNameStatistics; + + private StatisticsData statisticsData; + + private List<IStatisticsData> statisticsDataObjects; + private FileStatisticsHandler dataHandler; + + + public static StatisticsManager instance { get; private set; } + + + public void Awake() + { + if (instance != null) + { + Debug.LogError("Found more than one Statistics Manager in the scene."); + } + instance = this; + } + + private void Start() + { + this.dataHandler = new FileStatisticsHandler(Application.persistentDataPath, fileNameStatistics); + this.statisticsDataObjects = FindAllStatisticsObjects(); + LoadStatistics(); + } + + public void NewStatistics() + { + this.statisticsData = new StatisticsData(); + } + + public void LoadStatistics() + { + // load any saved data form a file using the data handler + this.statisticsData = dataHandler.Load(); + + + // if no data can be loaded, initialize to a new game + if (this.statisticsData == null) + { + NewStatistics(); + } + + // push the loaded data to all other scipts that need it + foreach (IStatisticsData statisticsDataObj in statisticsDataObjects) + { + statisticsDataObj.LoadStatistics(statisticsData); + } + + } + public void SaveStatistics() + { + // pass the data to other scripts so they can update it + foreach (IStatisticsData statisticsDataObj in statisticsDataObjects) + { + statisticsDataObj.SaveStatistics(ref statisticsData); + } + + // save that data to a file using the data handler + dataHandler.Save(statisticsData); + } + + private void OnApplicationQuit() + { + SaveStatistics(); + } + + private List<IStatisticsData> FindAllStatisticsObjects() + { + IEnumerable<IStatisticsData> statisticsDataObjects = FindObjectsOfType<MonoBehaviour>() + .OfType<IStatisticsData>(); + + return new List<IStatisticsData>(statisticsDataObjects); + } + +} diff --git a/Assets/Scripts/Statistics/StatisticsManager.cs.meta b/Assets/Scripts/Statistics/StatisticsManager.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..5acf8bbd8905dbdfb327c8625f5ad4ccc2b654a8 --- /dev/null +++ b/Assets/Scripts/Statistics/StatisticsManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 88721a2f76be08e449bdca94e099fa3d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Statistics/TextStatistics.cs b/Assets/Scripts/Statistics/TextStatistics.cs new file mode 100644 index 0000000000000000000000000000000000000000..d2dff854e365897fbd32ebe636e3932d1a8d88cc --- /dev/null +++ b/Assets/Scripts/Statistics/TextStatistics.cs @@ -0,0 +1,85 @@ +using System.Collections; +using System.Collections.Generic; +using Nightmare; +using UnityEngine; +using UnityEngine.UI; + + +public class TextStatistics : MonoBehaviour, IStatisticsData +{ + public static int shotsFired; + public static int shotsHit; + public static double shotAccuracy; + public static double distanceTraveled; + public static double playTime; + public static int highScore; + public static int allTimeScore; + public static int enemiesKilled; + + private Text statistics; + + void Awake() + { + TextStatistics.shotsFired = 0; + TextStatistics.shotsHit = 0; + TextStatistics.shotAccuracy = 0; + TextStatistics.distanceTraveled = 0; + TextStatistics.playTime = 0; + TextStatistics.highScore = 0; + TextStatistics.allTimeScore = 0; + TextStatistics.enemiesKilled = 0; + + this.statistics = GetComponent<Text>(); + } + + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + string timeText = System.TimeSpan.FromSeconds(TextStatistics.playTime).ToString("hh':'mm':'ss"); + if (TextStatistics.shotsFired != 0) + { + TextStatistics.shotAccuracy = ((double)TextStatistics.shotsHit / TextStatistics.shotsFired) * 100; + } + + statistics.text = "Shots Fired: " + TextStatistics.shotsFired + "\n" + + "Shots Hit: " + TextStatistics.shotsHit + "\n" + + "Shot Accuracy: " + TextStatistics.shotAccuracy.ToString("F2") + "%\n" + + "Distance Traveled: " + (TextStatistics.distanceTraveled / 1000).ToString("F3") + "km \n" + + "Play Time: " + timeText + "\n" + + "High Score: " + TextStatistics.highScore + "\n" + + "All Time Score: " + TextStatistics.allTimeScore + "\n" + + "Enemies Killed: " + TextStatistics.enemiesKilled + "\n"; + } + + + public void LoadStatistics(StatisticsData data) + { + TextStatistics.shotsFired = data.shotsFired; + TextStatistics.shotsHit = data.shotsHit; + TextStatistics.shotAccuracy = data.shotAccuracy; + TextStatistics.distanceTraveled = data.distanceTraveled; + TextStatistics.playTime = data.playTime; + TextStatistics.highScore = data.highScore; + TextStatistics.allTimeScore = data.allTimeScore; + TextStatistics.enemiesKilled = data.enemiesKilled; + } + + public void SaveStatistics(ref StatisticsData data) + { + data.shotsFired = TextStatistics.shotsFired; + data.shotsHit = TextStatistics.shotsHit; + data.shotAccuracy = TextStatistics.shotAccuracy; + data.distanceTraveled = TextStatistics.distanceTraveled; + data.playTime = TextStatistics.playTime; + data.highScore = InGameTextStatistics.score > TextStatistics.highScore ? InGameTextStatistics.score : TextStatistics.highScore; + data.allTimeScore = TextStatistics.allTimeScore; + data.enemiesKilled = TextStatistics.enemiesKilled; + } + +} diff --git a/Assets/Scripts/Statistics/TextStatistics.cs.meta b/Assets/Scripts/Statistics/TextStatistics.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..47831bcaceac021dd839c5834c5d7d806192ef75 --- /dev/null +++ b/Assets/Scripts/Statistics/TextStatistics.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cc69dcba98fc3554b93340e3297c3255 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Weapons/DefaultGun.cs b/Assets/Scripts/Weapons/DefaultGun.cs index dd275d14d6710fff962ff96e9961f3a60cc2e3c4..ec83cce8fb1fea0ae3052dd0dcc232518f1ec408 100644 --- a/Assets/Scripts/Weapons/DefaultGun.cs +++ b/Assets/Scripts/Weapons/DefaultGun.cs @@ -12,7 +12,7 @@ public class DefaultGun : Weapons LineRenderer gunLine; Light gunLight; Light faceLight; - + private void Awake() { // Set up the references. @@ -44,6 +44,10 @@ public class DefaultGun : Weapons shootRay.origin = transform.position; shootRay.direction = transform.forward; + TextStatistics.shotsFired++; + InGameTextStatistics.shotsFired++; + + // Perform the raycast against gameobjects on the shootable layer and if it hits something... if (Physics.Raycast(shootRay, out shootHit, range, shootableMask, QueryTriggerInteraction.Ignore)) { @@ -55,6 +59,8 @@ public class DefaultGun : Weapons { // ... the enemy should take damage. enemyHealth.TakeDamage(damagePerShot, shootHit.point); + TextStatistics.shotsHit++; + InGameTextStatistics.shotsHit++; } // Try and find an EnemyPetHealth script on the gameobject hit. diff --git a/Assets/Scripts/Weapons/Shotgun.cs b/Assets/Scripts/Weapons/Shotgun.cs index 923b41bb56ca42f3466b0f200dc9ff267f0d1f75..c365064e8ec93c7f456451912b8374f5652bbdcb 100644 --- a/Assets/Scripts/Weapons/Shotgun.cs +++ b/Assets/Scripts/Weapons/Shotgun.cs @@ -32,9 +32,20 @@ public class Shotgun : Weapons gunParticles.Stop(); gunParticles.Play(); + TextStatistics.shotsFired++; + InGameTextStatistics.shotsFired++; + + if (!isEnemyWeapon) { shootHit = Physics.SphereCastAll(transform.position, range, transform.forward, range, shootableMask, QueryTriggerInteraction.Ignore); + + if (shootHit.Length > 0) + { + TextStatistics.shotsHit++; + InGameTextStatistics.shotsHit++; + } + foreach (RaycastHit hit in shootHit) { EnemyHealth enemyHealth = hit.collider.GetComponent<EnemyHealth>(); @@ -43,7 +54,7 @@ public class Shotgun : Weapons { // ... the enemy should take damage. // Damage is lower the farther the enemy is. - int finalDamage = Mathf.Max(10, Mathf.RoundToInt(damagePerShot - hit.distance/range*damagePerShot)); + int finalDamage = Mathf.Max(10, Mathf.RoundToInt(damagePerShot - hit.distance / range * damagePerShot)); enemyHealth.TakeDamage(finalDamage, hit.point); } diff --git a/Assets/ShopManager.cs b/Assets/ShopManager.cs index 0f5c3b921ee1dcbdb50f9ca8bbfed8296280cbca..2d833d2bcad33174bb24e1a7c7b599e5d7d48030 100644 --- a/Assets/ShopManager.cs +++ b/Assets/ShopManager.cs @@ -82,7 +82,7 @@ public class ShopManager : MonoBehaviour { else if (isAccessible && !shopPanel.activeSelf) { resetCanvas(); - showMessage("Press key E to open shop"); + showMessage("Press key B to open shop"); return; } else if (!isAccessible && Input.GetKeyDown(KeyCode.B))