コード例 #1
0
    public void Attack()
    {
        attackState = attackList [attackC];
        subtitle.attackWarning();
//		if (attackState == aState.spitFire)
//			fire.SetActive (true);
        attackC++;
        if (attackC >= attackList.Length)
        {
            attackC = 0;
        }
    }
コード例 #2
0
    /// <summary>
    /// 分层播放,如果那一层的骨骼使用者是当前状态,则当前状态能播放状态,否则忽略
    /// </summary>
    /// <param name="aState"></param>
    /// <param name="time">时间的调整</param>
    /// <returns></returns>
    public float Play(aState aState, float?time = null)
    {
        ///获取将要播放状态的时间
        /// 根据时间进行调整4个参数
        float normalizedTime = time ?? 0;


        AnimatorController.CrossFade(aState.HashName, 0.2f, 0, normalizedTime);



        return(normalizedTime);
    }
コード例 #3
0
 void attack_DropHair(Vector3[] positoin, int[] numPerS)
 {
     for (int i = 0; i < numPerS [whichS]; i++)
     {
         Instantiate(hair, positoin [whichH], Quaternion.identity);
         whichH++;
     }
     whichS++;
     //attack end
     if (whichS > numPerS [0] || whichH > hairPosi1[0].x)
     {
         whichH      = 1;
         whichS      = 1;
         attackState = aState.idle;
     }
 }
コード例 #4
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (isStop)
        {
            return;
        }
        switch (attackState)
        {
        case aState.idle:
            interCount += Time.deltaTime;
            if (interCount > attackInterval)
            {
                interCount = 0;
                bossAnimator.SetTrigger(aStartID);
                subtitle.attackPre();
                if (attackInterval < 6 || attackInterval > 10)
                {
                    attackInterval = 8;
                }
                attackInterval = Random.Range(attackInterval - 2, attackInterval + 2);
            }
            break;

        case aState.dropHair1:
            if (attackF == hairInterval)
            {
                attackF = 0;
                attack_DropHair(hairPosi1, hairNumPerS1);
            }
            else
            {
                attackF++;
            }
            break;

        case aState.dropHair2:
            if (attackF == hairInterval)
            {
                attackF = 0;
                attack_DropHair(hairPosi2, hairNumPerS2);
            }
            else
            {
                attackF++;
            }
            break;

        case aState.dropHair3:
            if (attackF == hairInterval)
            {
                attackF = 0;
                attack_DropHair(hairPosi3, hairNumPerS3);
            }
            else
            {
                attackF++;
            }
            break;

        case aState.dropHair4:
            if (attackF == hairInterval)
            {
                attackF = 0;
                attack_DropHair(hairPosi4, hairNumPerS4);
            }
            else
            {
                attackF++;
            }
            break;

        case aState.spitFire:
            fireTime += Time.deltaTime;
            if (fireTime > 1.5)
            {
                fireTime    = 0;
                attackState = aState.idle;
                fire.SetActive(false);
            }

            break;

        case aState.prepare:
        default:
            break;
        }
    }