예제 #1
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.CompareTag("Platform") && isGrounded)
        {
            _anim.SetTrigger("Land");
            OnPlayerGrounded?.Invoke();

            ResetJumpMultiplier();

            Platform platform = other.gameObject.GetComponent <Platform>();

            if (platform.type == Platform.PlatformType.Green)
            {
                jumpFoceMultiplier = GameManager.Instance.greenPlatformJumpMultiplier;
            }
            else if (platform.type == Platform.PlatformType.Red)
            {
                jumpFoceMultiplier = GameManager.Instance.redPlatformJumpMultiplier;
            }
            else if (platform.type == Platform.PlatformType.Black)
            {
                StartCoroutine(envController.BlackenPlatforms());
            }

            if (other.gameObject != lastPlatformHit)
            {
                GameManager.Instance.addPlatformToScore();
                lastPlatformHit = other.gameObject;
            }
        }
    }