示例#1
0
    private void CheckForTraps()
    {
        Vector3 checkPoint = transform.position;

        checkPoint.y = 0.5f;
        Collider[] hitColliders = Physics.OverlapSphere(checkPoint, m_DetectionRange);
        int        i            = 0;

        while (i < hitColliders.Length)
        {
            ITrap foundTrap = hitColliders[i].GetComponent(typeof(ITrap)) as ITrap;
            if (foundTrap != null)
            {
                foundTrap.TrapDetected();
            }

            i++;
        }
    }