示例#1
0
    private void OnCollisionExit2D(Collision2D collision)
    {
        OverlabFootHold = FOOTHOLD_TYPE.FOOTHOLD_NONE;

        FootHoldTimer.SetActive(false);

        JumpFigures = 1.0f;

        IsJumpEnd = false;

        FootHoldSpeed = 0.0f;

        FootHoldStayTime = 0.0f;
    }
示例#2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "FOOTHOLD") //기본 발판.
        {
            OverlabFootHold = FOOTHOLD_TYPE.FOOTHOLD_NORMAL;
        }
        else if (collision.gameObject.tag == "FOOTHOLD_TIME") //시간 제한 발판
        {
            OverlabFootHold = FOOTHOLD_TYPE.FOOTHOLD_TIME;

            FootHoldTimer.SetActive(true);
        }
        else if (collision.gameObject.tag == "FOOTHOLD_DISPOSABLE") //일회용 발판
        {
            OverlabFootHold = FOOTHOLD_TYPE.FOOTHOLD_DISPOSABLE;
        }
        else if (collision.gameObject.tag == "FOOTHOLD_JUMPDOWN") //점프 다운 발판
        {
            OverlabFootHold = FOOTHOLD_TYPE.FOOTHOLD_JUMPDOWN;
        }
        else if (collision.gameObject.tag == "FOOTHOLD_JUMPUP") //점프 업 발판
        {
            OverlabFootHold = FOOTHOLD_TYPE.FOOTHOLD_JUMPUP;
        }

        if (OverlabFootHold != FOOTHOLD_TYPE.FOOTHOLD_NONE)
        {
            //충돌한것이 발판일때.

            float fY = transform.position.y; //플레이어의 Y값.

            float fFootHoldY = collision.gameObject.transform.position.y;

            if (fY > fFootHoldY && FinalFootHold != collision.gameObject)
            {
                //플레이어의 Y가 더 위에있다.
                //위에서 떨어졌다.
                //착지를 했다.
                ++FootHoldCnt;

                FinalFootHold = collision.gameObject;

                Debug.Log("착지 카운트 : " + FootHoldCnt.ToString());

                //PlayerY = transform.position.y + 4.2f;
                ////    PlayerY = PlayerY % 10.0f;

                ////    float f1 = PlayerY / 10.0f * 100.0f;
                ////    float f2 = 45.0f * f1 / 100.0f;

                ////    EvilutionUI_Image.rectTransform.sizeDelta = new Vector2(3.0f, f2);

                float f1 = 0.0f;
                float f2 = 0.0f;

                switch (GameLevel)
                {
                case 0:

                case 1:

                    f1 = FootHoldCnt / 7.0f * 100.0f;
                    f2 = 45.0f * f1 / 100.0f;

                    if (FootHoldCnt >= 7)
                    {
                        FootHoldCnt = 0;
                        ++GameLevel;

                        f2 = 0.0f;
                    }

                    break;

                case 2:

                    f1 = FootHoldCnt / 6.0f * 100.0f;
                    f2 = 45.0f * f1 / 100.0f;

                    if (FootHoldCnt >= 6)
                    {
                        FootHoldCnt = 0;
                        ++GameLevel;

                        f2 = 0.0f;
                    }

                    break;

                case 3:

                    f1 = FootHoldCnt / 5.0f * 100.0f;
                    f2 = 45.0f * f1 / 100.0f;

                    if (FootHoldCnt >= 5)
                    {
                        FootHoldCnt = 0;
                        ++GameLevel;

                        f2 = 0.0f;
                    }
                    break;

                case 4:

                case 5:

                    f1 = FootHoldCnt / 4.0f * 100.0f;
                    f2 = 45.0f * f1 / 100.0f;

                    if (FootHoldCnt >= 4)
                    {
                        FootHoldCnt = 0;
                        ++GameLevel;

                        f2 = 0.0f;
                    }

                    break;
                }

                EvilutionUI_Image.rectTransform.sizeDelta = new Vector2(3.0f, f2);
            }
        }
    }