LeaderboardCharacter.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. namespace JTSystems
  6. {
  7. [RequireComponent(typeof(JetCharacter))]
  8. public class LeaderboardCharacter : MonoBehaviour, IComparable
  9. {
  10. private JetCharacter.CharacterType characterType;
  11. private void Start()
  12. {
  13. characterType = GetComponent<JetCharacter>().GetCharacterType();
  14. }
  15. public bool IsPlayer()
  16. {
  17. return characterType == JetCharacter.CharacterType.Player;
  18. }
  19. public int CompareTo(object obj)
  20. {
  21. LeaderboardCharacter otherPlayerMovement = (LeaderboardCharacter)obj;
  22. switch(Leaderboard.instance.GetComparisonType())
  23. {
  24. case Leaderboard.ComparisonType.ZPosition:
  25. return otherPlayerMovement.transform.position.z.CompareTo(transform.position.z);
  26. default:
  27. return otherPlayerMovement.transform.position.z.CompareTo(transform.position.z);
  28. }
  29. }
  30. }
  31. }