PlayerStats.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class PlayerStats : MonoBehaviour
  5. {
  6. public int collisionCounter;
  7. public int coinCounter;
  8. public string condition;
  9. public int hasFinished;
  10. public int hasFinishedSlalom1;
  11. public int hasFinishedSlalom2;
  12. // Start is called before the first frame update
  13. void Start()
  14. {
  15. collisionCounter = 0;
  16. coinCounter = 0;
  17. hasFinished = -1;
  18. hasFinishedSlalom1 = -1;
  19. hasFinishedSlalom2 = -1;
  20. condition = "";
  21. }
  22. // Update is called once per frame
  23. void Update()
  24. {
  25. Debug.Log("Before :" + condition);
  26. var bikePlayer = GameObject.Find("BikePlayer - RigidBody");
  27. switch (bikePlayer.GetComponent<Controller.SensorBikeController>().steeringSelection)
  28. {
  29. case SteeringMode.frontWheel:
  30. condition = "frontWheel";
  31. break;
  32. case SteeringMode.Leaning:
  33. condition = "Leaning";
  34. break;
  35. case SteeringMode.HMD:
  36. condition = "HMD";
  37. break;
  38. }
  39. Debug.Log("After :" + condition);
  40. }
  41. public void IncreaseCollisionCounter()
  42. {
  43. collisionCounter += 1;
  44. }
  45. public void IncreaseCoinCounter()
  46. {
  47. coinCounter += 1;
  48. }
  49. }