예제 #1
0
    private void OnCollisionEnter(Collision collision)
    {
        Hitter hitter = collision.transform.gameObject.GetComponent <Hitter>();

        if (hitter != null)
        {
            OnHitterEnter?.Invoke(hitter);
        }
    }
예제 #2
0
    void OnParticleCollision(GameObject other)
    {
        Hitter hitter = other.GetComponent <Hitter>();

        if (hitter != null)
        {
            OnHitterEnter?.Invoke(hitter);
        }
    }
예제 #3
0
    private void OnTriggerEnter(Collider other)
    {
        Hitter hitter = other.transform.gameObject.GetComponent <Hitter>();

        if (hitter != null && hitter.gameObject.activeInHierarchy)
        {
            OnHitterEnter?.Invoke(hitter);

            if (hitter.GetType() == typeof(ActivatableHitter))
            {
                ActivatableHitter activatableHitter = (ActivatableHitter)hitter;

                if (activatableHitter.IsActive)
                {
                    onHitterActivated(activatableHitter, activatableHitter.LastParameters);
                }
                else if (!registeredHitters.Contains(activatableHitter))
                {
                    activatableHitter.OnActivate += onHitterActivated;
                    registeredHitters.Add(activatableHitter);
                }
            }
        }
    }