Пример #1
0
    private void OnCollisionStay2D(Collision2D collision)
    {
        if (rb.velocity.y <= 0f && rb.position == previousPosition && !isOnPlatform)
        {
            if (collision.collider.GetComponent <MovePlatform>() != null)
            {
                transform.SetParent(collision.collider.transform);
            }
            else
            {
                PlatformMech platformMech = collision.collider.GetComponent <PlatformMech>();
                if (platformMech != null)
                {
                    platformMech.StartCountdown();
                }
                else
                {
                    Ground ground = collision.collider.GetComponent <Ground>();
                    if (ground != null)
                    {
                        ground.Land();
                    }
                }
            }

            InstantiateNeedle();
            isOnPlatform = true;
            jumper.AnimateIdle();
        }

        previousPosition = rb.position;
    }