Speed Effect
This commit is contained in:
1 parent
e3ab4cc468
commit
3dcacafb8b
2 files changed
+15
-4792
No files matched your search
+10
-4791
File diff suppressed because it is too large.
Load diff
@@ -8,9 +8,9 @@ public class UiController : MonoBehaviour
|
|||||||
public GameObject player = null;
|
public GameObject player = null;
|
||||||
private Vector3 startPosition;
|
private Vector3 startPosition;
|
||||||
private Vector3 playerPosition;
|
private Vector3 playerPosition;
|
||||||
|
|
||||||
public TextMeshProUGUI uiDistance;
|
public TextMeshProUGUI uiDistance;
|
||||||
public float distance = 0.0f;
|
public float distance = 0.0f;
|
||||||
|
private float oldDistance = 0.0f;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
@@ -23,6 +23,10 @@ public class UiController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
playerPosition = this.player.transform.position;
|
playerPosition = this.player.transform.position;
|
||||||
distance = Vector3.Distance(this.startPosition, this.playerPosition);
|
distance = Vector3.Distance(this.startPosition, this.playerPosition);
|
||||||
|
if (oldDistance < distance)
|
||||||
|
{
|
||||||
uiDistance.text = "Score : " + distance.ToString("0");
|
uiDistance.text = "Score : " + distance.ToString("0");
|
||||||
|
oldDistance = distance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user