PlayerAttribute.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using System;
  2. using UnityEngine;
  3. public class PlayerAttribute
  4. {
  5. public int currentHP
  6. {
  7. get
  8. {
  9. return this._currentHP;
  10. }
  11. set
  12. {
  13. this._currentHP = Mathf.Clamp(value, 0, this.maxHP);
  14. }
  15. }
  16. public int currentEnergy
  17. {
  18. get
  19. {
  20. return this._currentEnergy;
  21. }
  22. set
  23. {
  24. this._currentEnergy = Mathf.Clamp(value, 0, this.maxEnergy);
  25. }
  26. }
  27. public int flashTimes
  28. {
  29. get
  30. {
  31. return (this.flashLevel < 2) ? 3 : 5;
  32. }
  33. }
  34. public bool isInCharging
  35. {
  36. get
  37. {
  38. return R.Player.Action.stateMachine.currentState == "Charging1" || R.Player.Action.stateMachine.currentState == "Charge1Ready" || R.Player.Action.stateMachine.currentState == "AirCharging";
  39. }
  40. }
  41. public bool isOnGround
  42. {
  43. get
  44. {
  45. return this.platform.State.IsDetectedGround;
  46. }
  47. }
  48. public bool isDead
  49. {
  50. get
  51. {
  52. return this.currentHP <= 0;
  53. }
  54. }
  55. public Bounds bounds
  56. {
  57. get
  58. {
  59. return R.Player.GetComponent<Collider2D>().bounds;
  60. }
  61. }
  62. private PlatformMovement platform
  63. {
  64. get
  65. {
  66. PlatformMovement result;
  67. if ((result = this._platform) == null)
  68. {
  69. result = (this._platform = R.Player.GetComponent<PlatformMovement>());
  70. }
  71. return result;
  72. }
  73. }
  74. public void ResetData()
  75. {
  76. this.SetBaseLevelData();
  77. this.AllAttributeRecovery();
  78. }
  79. private void SetBaseLevelData()
  80. {
  81. this.maxHP = DB.Enhancements["maxHP"].GetEnhanceEffect(R.Player.Enhancement.MaxHp);
  82. this.baseAtk = ((!Debug.isDebugBuild) ? 40 : ((!R.Settings.CheatMode) ? 40 : 9999));
  83. this.maxEnergy = ((R.GameData.Difficulty != 3) ? 10 : 1);
  84. this.moveSpeed = 9f;
  85. this.currentFlashTimes = this.flashTimes;
  86. this.maxChargeTime = 2.5f;
  87. }
  88. public void AllAttributeRecovery()
  89. {
  90. this.maxHP = DB.Enhancements["maxHP"].GetEnhanceEffect(R.Player.Enhancement.MaxHp);
  91. this.currentHP = this.maxHP;
  92. this.currentEnergy = this.maxEnergy;
  93. this.currentFlashTimes = this.flashTimes;
  94. R.Ui.Flash.RecoverAll(this.flashTimes);
  95. }
  96. public const int maxExecuteNum = 1;
  97. public const float ChargeTime = 2.5f;
  98. private const float BaseMoveSpeed = 9f;
  99. public int faceDir;
  100. public int maxHP;
  101. [SerializeField]
  102. private int _currentHP;
  103. public int maxEnergy;
  104. [SerializeField]
  105. private int _currentEnergy;
  106. public float moveSpeed;
  107. public int flashLevel = 1;
  108. public int currentFlashTimes;
  109. public int FlashCd;
  110. public bool flashFlag;
  111. [HideInInspector]
  112. public float maxChargeTime;
  113. public int maxChargeEndureDamage;
  114. public int baseAtk;
  115. [NonSerialized]
  116. private PlatformMovement _platform;
  117. }