CrystalBaseData.cs 872 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public class CrystalBaseData {
  5. public const int maxPowerLevel = 5;
  6. public int id;
  7. public int teamId;
  8. public int powerLevel;
  9. public bool occupied;
  10. public List<ServicePlayer> playerList;
  11. public CrystalBaseData(int id)
  12. {
  13. this.id = id;
  14. playerList = new List<ServicePlayer>();
  15. }
  16. public void powerLevelChange(int teamId)
  17. {
  18. if(this.teamId == TeamUtil.Team.None.GetHashCode() || this.teamId == teamId)
  19. {
  20. if(this.teamId == TeamUtil.Team.None.GetHashCode())
  21. {
  22. this.teamId = teamId;
  23. }
  24. powerLevel++;
  25. if(powerLevel >= maxPowerLevel)
  26. {
  27. powerLevel = maxPowerLevel;
  28. if(!occupied)
  29. {
  30. occupied = true;
  31. }
  32. }
  33. }
  34. else
  35. {
  36. powerLevel--;
  37. if(powerLevel <= 0)
  38. {
  39. this.teamId = TeamUtil.Team.None.GetHashCode();
  40. }
  41. }
  42. }
  43. }