示例#1
0
    private void OnCollisionExit2D(Collision2D collision)
    {
        KNGPlatform platform = collision.gameObject.GetComponent <KNGPlatform>();

        if (platform != null)
        {
            grounded = false;
        }
    }
示例#2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        GameObject other = collision.collider.gameObject;

        if (other.GetComponent <KNGKillZone>() != null)
        {
            // we hit a kill zone, destroy this object
            GameObject.Destroy(gameObject);
        }
        else
        {
            KNGPlatform platform = other.GetComponent <KNGPlatform>();

            if (platform != null)
            {
                grounded = true;
                if (platform.isObstacleFlipper)
                {
                    // we hit a platform, flip momentum
                    ChangeDirection();
                }
            }
        }
    }