T02.cs 593 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace LearnStorage
  5. {
  6. /// <summary>
  7. ///
  8. /// </summary>
  9. public class T02 : MonoBehaviour
  10. {
  11. [Range(0, 10)]
  12. public int Level = 0;
  13. private PlayerStatus ps = new PlayerStatus();
  14. private void Start()
  15. {
  16. Debug.Log(ps.Health);
  17. ps.Health -= 10;
  18. Debug.Log(ps.Health);
  19. }
  20. // 无MonoBehaviour
  21. // C#数据类
  22. // 字段
  23. // 属性
  24. // 构造函数
  25. // 方法
  26. // 脚本
  27. // 字段
  28. // 方法
  29. // 避免在脚本中写构造函数
  30. }
  31. }