Пример #1
0
    public IEnumerator AddQte(JBaseQte.Types T, bool isRandom, float fPause)
    {
        Vector3 R = Random.onUnitSphere;

        R.z  = 0;
        R.y *= 1.0f;
        yield return(new WaitForSeconds(fPause));

        if (NUms.ContainsKey(T) && current == null)
        {
            GameObject go = null;
            if (isRandom)
            {
                go = Instantiate(qtPref[NUms[T]], R, Quaternion.identity) as GameObject;
            }
            else
            {
                go = Instantiate(qtPref[NUms[T]]) as GameObject;
            }

            go.transform.SetParent(Cnvs.transform, false);
            if (isRandom)
            {
                go.transform.Translate(R);
            }
            current = go.GetComponent <JBaseQte>();
            current.onCompDelegate += OnComplete;
            current.setBaseAndSpeed(Player.Dext, Foe.Dext);
        }
    }
Пример #2
0
 void AddQTEObject(JBaseQte.Types T, bool isR, float fPause)
 {
     if (current != null)
     {
         DestroyImmediate(current.gameObject);
     }
     StartCoroutine(AddQte(T, isR, fPause));
 }
Пример #3
0
    void OnComplete(float value, JBaseQte.Types t)
    {
        Debug.Log("V:" + value);
        bool  isRandom = false;
        float fP       = 0.5f;

        JBaseQte.Types TypeToCreate = JBaseQte.Types.QTEBASE;
        switch (t)
        {
        case JBaseQte.Types.QTEBALLANCE:
            float Width = ((float)Player.Dext / (float)Foe.Dext) * 0.5f;
            Debug.Log((1.0f - Width) * 0.5f);
            if (value <= (1.0f - Width) * 0.5f || value > (1.0f + Width) * 0.5f)
            {
                RightAnimator.SetTrigger("tAttack");
                TypeToCreate = JBaseQte.Types.QTEBUTTON;
            }
            else
            {
                LeftAnimator.SetTrigger("tAttack");
                CAttTurn     = AttTurns;
                TypeToCreate = JBaseQte.Types.QTETIMEBUTTON;
                isRandom     = true;
            }
            break;

        case JBaseQte.Types.QTETIMEBUTTON:
            if (value > 0.1f)
            {
                CAttTurn--;
                if (CAttTurn <= 0)
                {
                    FHp -= Player.Att;
                    RightAnimator.SetTrigger("tWound");
                    LeftAnimator.SetTrigger("tAttackOff");
                    TypeToCreate = JBaseQte.Types.QTEBALLANCE;
                }
                else
                {
                    isRandom     = true;
                    TypeToCreate = JBaseQte.Types.QTETIMEBUTTON;
                    fP           = 0.1f;
                }
            }
            else
            {
                RightAnimator.SetTrigger("tBlock");
                LeftAnimator.SetTrigger("tAttackOff");
                TypeToCreate = JBaseQte.Types.QTEBALLANCE;
            }

            break;

        case JBaseQte.Types.QTEBUTTON:
            if (value < 0.9f)
            {
                PHp -= Foe.Att;
                LeftAnimator.SetTrigger("tWound");
            }
            else
            {
                LeftAnimator.SetTrigger("tBlock");
            }
            RightAnimator.SetTrigger("tAttackOff");
            TypeToCreate = JBaseQte.Types.QTEBALLANCE;
            break;
        }

        if ((PHp <= 0 || FHp <= 0))
        {
            if (PHp <= 0)
            {
                RWins++;
            }
            else
            {
                LWins++;
            }
            if (current != null)
            {
                DestroyImmediate(current.gameObject);
            }
            ResetFunc();
        }
        else
        {
            AddQTEObject(TypeToCreate, isRandom, fP);
        }
    }