コード例 #1
0
    //ジャンプ後
    IEnumerator FlyProc()
    {
        Vector3 stopPos;
        float   LIMIT_WDT            = 3f;
        float   LIMIT_DISTANCE       = 0.1f;
        float   LOWER_LIMIT_VELOCITY = 5f;
        float   wdt;

        StartCoroutine(MonitorDistancefromTrapeze());
        while (stat == stat_enum.fly)
        {
            //  Debug.Log(velocity);
            if (velocity < LOWER_LIMIT_VELOCITY)
            {
                stopPos = rb.position;
                wdt     = 0f;
                while (Vector3.Distance(rb.position, stopPos) < LIMIT_DISTANCE)
                {
                    //                    Debug.Log("b");
                    if (wdt > LIMIT_WDT)
                    {
                        stat = stat_enum.finish;
                        yield break;
                    }
                    wdt += Time.deltaTime;
                    yield return(null);
                }
            }
            yield return(null);
        }
    }
コード例 #2
0
    //ジャンプ待機
    IEnumerator PreJumpProc()
    {
        bool    oldDrag           = false;
        float   draggingSpan      = 0f;   //ドラッグ開始からの時間[s]
        float   draggingSpanLimit = 0.5f; //ドラッグ終了までの制限時間。ゆっくりドラッグすると無視する。
        Vector3 jumpForce;

        while (DragMonitor.Drag)
        {
            yield return(null);
        }
        while (JUMP_on)
        {
            //待機モーション生成
            Vector3 force_pos = rb.position;
            force_pos.x = 0f;
            SetDestination(0.7f, -1f);
            //Debug.Log(preForce);

            //フリック監視
            if (DragMonitor.Drag)                                                              //ドラッグ中
            {
                if (Vector3.Distance(DragMonitor.TapPosition, DragMonitor.DragPosition) > 30f) //一定距離以上ドラッグ
                {
                    draggingSpan += Time.deltaTime;
                }
            }


            if (oldDrag && !DragMonitor.Drag)
            {
                if (draggingSpan <= draggingSpanLimit && draggingSpan > 0) //一定時間以内にドラッグ終了
                {
                    jumpForce   = (DragMonitor.DragPosition - DragMonitor.TapPosition).normalized * JumpMultiplier;
                    jumpForce.z = -jumpForce.x;
                    jumpForce.x = 0;
                    jumpForce   = rb_Trapaze.transform.TransformDirection(jumpForce);
                    //Debug.Log(jumpForce);
                    PlayingManager.playingManager.Stat = PlayingManager.Stat_global.jump;
                    stat = stat_enum.jump;
                    StartCoroutine(JumpProc(jumpForce, force_pos));
                    yield break;
                }
                else
                {
                    draggingSpan = 0f; //ゆっくりドラッグされたことを検知した場合最初から
                }
            }
            oldDrag = DragMonitor.Drag;

            yield return(new WaitForFixedUpdate());
        }
    }
コード例 #3
0
 //ジャンプ(実際のジャンプ)
 IEnumerator JumpProc(Vector3 jumpForce, Vector3 forcePos)
 {
     rb.AddForceAtPosition(jumpForce * Multiplier, forcePos, ForceMode.Force);
     Spine1.AddForceAtPosition(jumpForce * Multiplier, forcePos, ForceMode.Force);
     //R_UpLeg.AddForceAtPosition(jumpForce * Multiplier / 2, forcePos, ForceMode.Force);
     //L_UpLeg.AddForceAtPosition(jumpForce * Multiplier / 2, forcePos, ForceMode.Force);
     rb_Trapaze.mass = 115f;
     rb_Trapaze.AddForceAtPosition(-jumpForce * Multiplier * 3, forcePos, ForceMode.Force);
     FreeClingJoints();
     FreeHoldMascles();
     mslL_UpLeg.Hold(180f);
     mslR_UpLeg.Hold(180f);
     mslL_Leg.Hold(180f);
     mslR_Leg.Hold(180f);
     stat = stat_enum.fly;
     StartCoroutine(DelayFreeHoldMasclesProc());
     StartCoroutine(FlyProc());
     yield break;
 }
コード例 #4
0
    void Update()
    {
        //速度表示
        if (stat == stat_enum.row || stat == stat_enum.pre_jump)
        {
            this.velocity = rb_tracePoint.velocity.magnitude * 3.6f;
        }
        else
        {
            this.velocity = rb.velocity.magnitude * 3.6f;
        }

        //漕いでいる最中
        if (stat == stat_enum.row)
        {
            SetDestination();
            if (JUMP_on)
            {
                Jump();
                stat = stat_enum.pre_jump;
            }
        }

        //ジャンプ待機
        else if (stat == stat_enum.pre_jump)
        {
            if (!JUMP_on)
            {
                stat = stat_enum.row;
            }
        }
        //ジャンプ後
        else if (stat == stat_enum.fly)
        {
        }

        //Debug.Log(this.velocity);
    }
コード例 #5
0
    //ジャンプ後のブランコ引っかかり検知
    IEnumerator MonitorDistancefromTrapeze()
    {
        float LIMIT_WDT      = 5f;
        float LIMIT_DISTANCE = 1f;

        float wdt;

        while (stat == stat_enum.fly)
        {
            wdt = 0f;
            while (Vector3.Distance(rb.position, rb_tracePoint.position) < LIMIT_DISTANCE)
            {
                if (wdt > LIMIT_WDT)
                {
                    stat = stat_enum.finish; //ブランコから一定範囲内に一定時間とどまっていると強制的にリザルト
                    yield break;
                }
                wdt += Time.deltaTime;
                yield return(null);
            }
            yield return(null);
        }
    }