예제 #1
0
    //IEnumerator AirSpin() {
    //    yield return new WaitForSeconds(airSpinningDuration);
    //    isAirSpinning = false;
    //}

    bool IsGrounded()
    {
        int groundLayer = 8;

        colliders = new Collider2D[MAX_GROUNED_COLLIDER_CHECK];
        PhysicsScene2D.OverlapCollider(GetComponent <Collider2D>(), colliders, Physics2D.DefaultRaycastLayers);
        for (int i = 0; i < colliders.Length; i++)
        {
            if (colliders[i])
            {
                if (colliders[i].gameObject.layer.Equals(groundLayer))
                {
                    isAirSpinning = false;
                    return(true);
                }
            }
        }
        return(false);
    }