game(scripts): better prompts + stopwatch
This commit is contained in:
parent
db81775d1a
commit
c04f5aa97c
|
@ -122,154 +122,6 @@ NavMeshSettings:
|
|||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1001 &1120089
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 974238578668270704, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 6
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 974238578668270716, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_Actions
|
||||
value:
|
||||
objectReference: {fileID: -944628639613478452, guid: 4419d82f33d36e848b3ed5af4c8da37e,
|
||||
type: 3}
|
||||
- target: {fileID: 974238578668270716, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -11.310009
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 14.179999
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -37.019993
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: -0.9914804
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.13025612
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: -374.969
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3128949090649374765, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Player
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3203261902030644824, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0.20000017
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3203261902030644824, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.4449997
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3203261902030644824, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -3.9999988
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5542111180780342640, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_BackGroundColor.a
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5542111180780342640, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_BackGroundColor.b
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5542111180780342640, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_BackGroundColor.g
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5542111180780342640, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_BackGroundColor.r
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5542111180780342642, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: MainCamera
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5542111180780342647, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0.20000017
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5542111180780342647, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.4449997
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5542111180780342647, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -3.9999988
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8047161636021232021, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: NestedParentArmature_Unpack
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 974238578668270704, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 491771526}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: c708a3b79cd542b42bbfedb17e213bc1, type: 3}
|
||||
--- !u!1 &13596640
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -7350,29 +7202,6 @@ Mesh:
|
|||
offset: 0
|
||||
size: 0
|
||||
path:
|
||||
--- !u!1 &491771518 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 974238578668270704, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1120089}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &491771526
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 491771518}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4995ad0b66292c144ab3819605824571, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
playerPosition: {fileID: 1013448445}
|
||||
interactableDistance: 2
|
||||
raycastLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 439
|
||||
--- !u!43 &554144876
|
||||
Mesh:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -9164,12 +8993,6 @@ Mesh:
|
|||
offset: 0
|
||||
size: 0
|
||||
path:
|
||||
--- !u!4 &1013448445 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 5542111180780342647, guid: c708a3b79cd542b42bbfedb17e213bc1,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1120089}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1060921175
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -25892,6 +25715,8 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
guiInteractionPromptObject: {fileID: 1226619922}
|
||||
guiHudObject: {fileID: 618797798}
|
||||
guiCompletedMenuObject: {fileID: 395649654}
|
||||
player: {fileID: 1934526679}
|
||||
--- !u!4 &1766444915
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -26807,6 +26632,80 @@ MonoBehaviour:
|
|||
sourceAsset: {fileID: 9197481963319205126, guid: b5ee53c3e1d1258499a4641d355c972a,
|
||||
type: 3}
|
||||
m_SortingOrder: 0
|
||||
--- !u!1001 &1934526678
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -10.63
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 14.54
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -37.36
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1276608354021537599, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7550015751290207618, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: player
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fede53ad5812a1046bf12a85cacb875a, type: 3}
|
||||
--- !u!1 &1934526679 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7550015751290207618, guid: fede53ad5812a1046bf12a85cacb875a,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1934526678}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!43 &2033145775
|
||||
Mesh:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -27146,7 +27045,7 @@ SceneRoots:
|
|||
- {fileID: 438254297}
|
||||
- {fileID: 567431775}
|
||||
- {fileID: 1656492132}
|
||||
- {fileID: 1120089}
|
||||
- {fileID: 1934526678}
|
||||
- {fileID: 1060921176}
|
||||
- {fileID: 596429548}
|
||||
- {fileID: 897146492}
|
||||
|
|
|
@ -56,6 +56,11 @@ public enum DisplayState
|
|||
/// </summary>
|
||||
public GameObject player;
|
||||
|
||||
/// <summary>
|
||||
/// color for the stopwatch when the player is running late
|
||||
/// </summary>
|
||||
private readonly Color _colorRunningLateRed = new(193, 39, 45);
|
||||
|
||||
/// <summary>
|
||||
/// float to keep track of the elapsed play/run/speeder time
|
||||
/// </summary>
|
||||
|
@ -149,12 +154,23 @@ private void Start()
|
|||
private void Update()
|
||||
{
|
||||
if (Paused) return;
|
||||
|
||||
_elapsedRunTime += Time.deltaTime;
|
||||
var minutes = _elapsedRunTime / 60;
|
||||
var seconds = _elapsedRunTime % 60;
|
||||
var milliseconds = _elapsedRunTime * 1000 % 1000;
|
||||
_uiLabelStopwatch.text = $"{minutes:00}:{seconds:00}.{milliseconds:000}";
|
||||
|
||||
var displayedElapsedRunTime = _elapsedRunTime;
|
||||
var stopwatchPrefix = "";
|
||||
|
||||
if (_elapsedRunTime > 299.9999999999f)
|
||||
{
|
||||
stopwatchPrefix = "-";
|
||||
displayedElapsedRunTime -= 10f;
|
||||
_uiLabelStopwatch.style.color = _colorRunningLateRed;
|
||||
}
|
||||
|
||||
var minutes = displayedElapsedRunTime / 60;
|
||||
var seconds = displayedElapsedRunTime % 60;
|
||||
var milliseconds = displayedElapsedRunTime * 1000 % 1000;
|
||||
|
||||
_uiLabelStopwatch.text = $"{stopwatchPrefix}{minutes:00}:{seconds:00}.{milliseconds:000}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -459,6 +475,7 @@ public void SetInteractionPrompt(string prompt)
|
|||
/// </summary>
|
||||
public void ClearInteractionPrompt()
|
||||
{
|
||||
_uiLabelInteractionPrompt.text = "";
|
||||
_uiLabelInteractionPrompt.visible = false;
|
||||
}
|
||||
|
||||
|
@ -480,8 +497,8 @@ public void ProperlyEndRun()
|
|||
|
||||
// scoring parameters
|
||||
const float maxScore = 1000f;
|
||||
const float maxTimeForMaxScore = 15f; // 2.5 minutes
|
||||
const float maxTimeForMinScore = 180f; // 5 minutes
|
||||
const float maxTimeForMaxScore = 120f; // 2.5 minutes
|
||||
const float maxTimeForMinScore = 300f; // 5 minutes
|
||||
|
||||
var score = _elapsedRunTime switch
|
||||
{
|
||||
|
|
|
@ -74,9 +74,21 @@ private void Update()
|
|||
|
||||
if (!_raycast) return;
|
||||
|
||||
var interactable = _hit.collider.GetComponent<CommonInteractable>();
|
||||
if (!interactable)
|
||||
{
|
||||
// Debug.Log("not looking at an interactable object");
|
||||
GameManager.Instance.ClearInteractionPrompt();
|
||||
return;
|
||||
}
|
||||
|
||||
// show an interaction prompt if we're looking at an interactable object
|
||||
var prompt = _hit.collider.GetComponent<CommonInteractable>()?.interactionPrompt;
|
||||
if (prompt != "") Debug.Log(prompt);
|
||||
var prompt = interactable.interactionPrompt;
|
||||
// Debug.Log(prompt);
|
||||
if (prompt != "")
|
||||
GameManager.Instance.SetInteractionPrompt(prompt);
|
||||
else
|
||||
GameManager.Instance.ClearInteractionPrompt();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Reference in a new issue