| 123456789101112131415161718192021222324252627 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SoulCollector : MonoBehaviour
- {
- public PlayerController player;
- private void Awake()
- {
- player = GetComponentInParent<PlayerController>();
- }
- private void OnTriggerEnter(Collider other)
- {
- Soul soul = other.GetComponentInParent<Soul>();
- if (soul)
- {
- if (player == null)
- {
- player = GetComponentInParent<PlayerController>();
- }
- soul.BeCollect(player.playerId);
- PoolManager.Instantiate(soul.getSoulEffect, transform.position);
- }
- }
- }
|