PlayerStats.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 SetWaypointPassed(WaypointType type)
  42. {
  43. switch (type)
  44. {
  45. case WaypointType.slalom1:
  46. hasFinishedSlalom1 = 1;
  47. break;
  48. case WaypointType.slalom2:
  49. hasFinishedSlalom2 = 1;
  50. break;
  51. case WaypointType.finish:
  52. hasFinished = 1;
  53. break;
  54. }
  55. }
  56. public void IncreaseCollisionCounter()
  57. {
  58. collisionCounter += 1;
  59. }
  60. public void IncreaseCoinCounter()
  61. {
  62. coinCounter += 1;
  63. }
  64. }