コード例 #1
0
    private void Update()
    {
        Collider2D[] edgeColliders = Physics2D.OverlapCircleAll(transform.position, radius)
                                     .Where(collid => collid.CompareTag("MovingPlatformEdge"))
                                     .ToArray();

        if (edgeColliders.Length <= 0)
        {
            alreadyTriggered = false;
            return;
        }

        if (alreadyTriggered)
        {
            return;
        }

        foreach (Collider2D collid in edgeColliders)
        {
            _platform.EndReached();
        }
        alreadyTriggered = true;
    }