RenShuTrigger.cs 931 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace DTYJ
  5. {
  6. public class RenShuTrigger : MonoBehaviour
  7. {
  8. public string positionName;
  9. public static Dictionary<string, int> dicCount = new Dictionary<string, int>() { { "վ̨", 0 }, { "Õ¾Ìü", 0 } };
  10. int _totalCount = 0;
  11. int totalCount
  12. {
  13. get { return _totalCount; }
  14. set
  15. {
  16. _totalCount = value;
  17. dicCount[positionName] = _totalCount;
  18. }
  19. }
  20. private void OnTriggerEnter(Collider other)
  21. {
  22. if (other.GetComponent<Chengke>() != null)
  23. {
  24. ++totalCount;
  25. }
  26. }
  27. private void OnTriggerExit(Collider other)
  28. {
  29. if (other.GetComponent<Chengke>() != null)
  30. {
  31. --totalCount;
  32. }
  33. }
  34. }
  35. }