예제 #1
0
    private void Update()
    {
        if (this.gameObject == selectedMembrane)
        {
            glowingEffect.SetActive(true); //터치하면 선택 이미지를 활성화한다.
            if (padDirection.getIsTouch())
            {
                double angle = Mathf.Atan2(padDirection.getDirection().x, padDirection.getDirection().y) * (180.0 / Mathf.PI);
                this.transform.rotation = Quaternion.Euler(0, 0, -(float)angle); //조이스틱의 방향에 따라 방향을 변경
                membraneDirection       = padDirection.getDirection();           //탄성막이 향하는 방향을 저장해 둔다.
            }
        }
        else
        {
            glowingEffect.SetActive(false);
        }

        if (startDelta)//선택이 끝나면 파괴되기까지의 카운트 다운 시작
        {
            destroyDelta -= Time.deltaTime;
            if (destroyDelta < 0)
            {
                usefullOperation.FadeOut(2, GetComponent <SpriteRenderer>());                  //설치하고 15초가 지나면 파괴
            }
        }
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        transform.position = playerImageController.getBottlePosition();

        if (padStrength.isTouch || padStrength.isThrowing || skillButton.getUsingSkill() || bottleSelectController.bottleController.isSuperPowerAvailabe)
        {
            transform.GetChild(0).gameObject.SetActive(false);
        }
        else if (padDirection.getIsTouch())
        {
            transform.GetChild(0).gameObject.SetActive(true);
            double angle = Mathf.Atan2(padDirection.getDirection().y, padDirection.getDirection().x) * (180.0 / Mathf.PI) + 185;
            if (padDirection.getDirection().magnitude == 0)
            {
                this.transform.rotation = Quaternion.Euler(0, 0, 0);                                             //드래그를 안 했을 시 회전하지 않는다.
            }
            else
            {
                this.transform.rotation = Quaternion.Euler(0, 0, (float)angle);  //조이스틱의 방향에 따라 방향을 변경
            }
        }
    }
예제 #3
0
    void Update()
    {
        if (padStrength.isTouch)
        {
            padStrengthTouched = true;
        }
        if (padDirection.getIsTouch())
        {
            padDirectionTouched = true;                            //오타 수정
        }
        if ((padStrength.isTouch || padDirectionTouched) && (!isSuperPowerAvailabe) && gameObject.CompareTag("isActBottle"))
        // 방향 패드만 눌렸을 때 기본 힘으로 포물선 그리기, 후에 힘버튼으로 포물선 조정
        {
            trajectoryLine.Draw(padStrengthTouched, padDirection.getDirection(), padStrength.totalStrength);
            transform.position = playerImageController.getBottlePosition(); // 물병 위치 갱신
        }

        if (gameObject.CompareTag("unActBottle"))
        {
            Vector2 distance = gameObject.transform.position - playerImageController.getBottlePosition();
            zRotation = gameObject.transform.eulerAngles.z;
            delta    += Time.deltaTime;

            if (distance.magnitude < 2)
            {
                gameObject.SetActive(false); //던져진 물병이 물병 생성 위치와 너무 가까이 있으면 비활성화
            }
            if (standingBySkill)             //필살기 발동에 의해 물병이 세워짐
            {
                standingDelay -= Time.deltaTime;
                rb.WakeUp();
                rb.centerOfMass = new Vector3(0, -0.6f, 0);

                if (standingDelay < 0)
                {
                    standingDelay   = 2;
                    standingBySkill = false;
                    rb.centerOfMass = Vector3.zero;
                    if (!isDestroying)
                    {
                        usefullOperation.FadeOut(1, this.transform.GetChild(0).GetComponent <SpriteRenderer>());              //파괴 도중에 실행되면 오류 발생
                    }
                }
            }

            if (standBottle) //물병이 세워지는 경우
            {
                if (delta < 0.6f && transform.eulerAngles.z < 340 && transform.eulerAngles.z > 20)
                {
                    if (zRotation > 340)
                    {
                        transform.Rotate(new Vector3(0, 0, 180 * Time.smoothDeltaTime), Space.World);                  //물병의 z축 값을 360으로 수렴
                    }
                    else
                    {
                        transform.Rotate(new Vector3(0, 0, -180 * Time.smoothDeltaTime), Space.World);  //물병의 z축 값을 0으로 수렴
                    }
                }
                else if (delta < 0.9f)
                {
                    if (transform.eulerAngles != Vector3.zero)
                    {
                        transform.rotation = Quaternion.Euler(Vector3.zero);
                        rb.constraints     = RigidbodyConstraints2D.FreezeRotation;
                    }
                    rb.AddForce(new Vector2(0, -1000 * Time.smoothDeltaTime)); // 물병이 튀어오르지 않도록 아래로 힘 작용
                }
                else
                {
                    standBottle    = false;
                    rb.constraints = RigidbodyConstraints2D.None; //z축 회전고정 해제
                }
            }

            // 세워져 있는지의 여부 수정 및 텐션게이지 상승
            if (((delta > 1.49f) && !((zRotation > 340) || (zRotation < 20))) || onFloor)
            {
                isStanding     = false;
                tensionGaugeUp = false;
                if (delta < 1.5f)
                {
                    combo = 0;
                    tensionGaugeManager.comboText = "";
                }
            }
            else if ((delta > 1f) && (Mathf.Abs(rb.angularVelocity) < 0.1f) && ((zRotation > 340) || (zRotation < 20)))
            {
                isStanding = true;
                if (tensionGaugeUp)
                {
                    combo++;
                    tensionGaugeManager.IncreaseTensionGauge(2, combo); //10% * 콤보수 만큼 상승
                    tensionGaugeUp = false;
                }
            }
        }

        if (onFloor) //NEW: 땅바닥에 닿았을 때 물병 파괴
        {
            destroyDelay -= Time.deltaTime;
            if (destroyDelay < 0)
            {
                usefullOperation.FadeOut(1, this.transform.GetChild(0).GetComponent <SpriteRenderer>());
                usefullOperation.FadeOut(2, transparent);
            }
            isDestroying = true;
        }


        if (gameObject.transform.position.y < -10 && !isDestroying) // 물병이 화면 밖으로 날아갔을 때
        {
            if (gameObject.CompareTag("unActBottle"))
            {
                Destroy(gameObject);                                       // 어딘가 부딪히고 화면 밖으로 튕겨나갔을 때
            }
            else
            {
                if (Time.timeScale != 1) //염력 사용하다가 화면 밖으로 날아간 경우
                {
                    Time.timeScale      = 1;
                    Time.fixedDeltaTime = 0.02f * Time.timeScale;
                    screenEffectController.shadowEffect.enabled = false;
                    screenEffectController.screenEffectNum      = 1;
                }
                gameObject.tag = "unActBottle";                        //태그가 사라짐
                bottleSelectController.bottleSelected = false;
                bottleGenerator.GenerateBottleWithDelay(0.75f);        //물병 생성
                bottleSelectController.ReselectBottleWithDelay(0.75f); //물병 재선택
                Destroy(gameObject);                                   //해당 물병 파괴
            }
        }
    }