SoulCollector.cs 460 B

12345678910111213141516171819202122
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class SoulCollector : MonoBehaviour
  5. {
  6. public PlayerController player;
  7. private void Awake()
  8. {
  9. player = GetComponentInParent<PlayerController>();
  10. }
  11. private void OnTriggerEnter(Collider other)
  12. {
  13. Soul soul = other.GetComponentInParent<Soul>();
  14. if (soul)
  15. {
  16. soul.BeCollect(player.playerId);
  17. }
  18. }
  19. }