Role.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace FSRole {
  5. /*
  6. * 角色组件
  7. */
  8. public class Role : MonoBehaviour {
  9. // 角色原始属性
  10. public RoleAttr OriginAttr {
  11. set;
  12. get;
  13. }
  14. // 角色当前属性
  15. public RoleAttr CurrentAttr {
  16. set;
  17. get;
  18. }
  19. // Use this for initialization
  20. void Start() {
  21. }
  22. // Update is called once per frame
  23. void Update() {
  24. }
  25. /*
  26. * 添加角色的各个接口
  27. */
  28. /*
  29. * 受到伤害
  30. */
  31. public void GetDamage(int value) {
  32. CurrentAttr.Hp -= value;
  33. print("受到伤害");
  34. }
  35. /*
  36. * 消耗精力
  37. */
  38. public void CostEngine(int value) {
  39. CurrentAttr.Mp -= value;
  40. print("消耗精力");
  41. }
  42. /*
  43. * 增加防御力
  44. */
  45. public void Defense(int value) {
  46. CurrentAttr.Def += value;
  47. print("防御");
  48. }
  49. }
  50. }