示例#1
0
        private void CheckRunState()
        {
            if (Time.time - lastCheckTime > 0.2f)
            {
                lastCheckTime = Time.time;
                if (curActorState == ACTOR_STATE.AS_RUN)
                {
                    if (IsRiding && RunType != 1)
                    {
                        RunType = 1;
                        PlaySound(RideClip);

                        AudioSource1.loop = true;
                    }
                    else if (!IsRiding && IsWing && RunType != 2)
                    {
                        RunType           = 2;
                        AudioSource1.loop = false;
                        AudioSource1.Stop();
                    }
                    else if (!IsRiding && !IsWing && RunType != 3)
                    {
                        RunType = 3;
                        PlaySound(RunClip);

                        AudioSource1.loop = true;
                    }
                }
            }
        }
示例#2
0
 public override void OnExitState(ACTOR_STATE state)
 {
     if (state == ACTOR_STATE.AS_RUN && curActorState == ACTOR_STATE.AS_RUN)
     {
         RunType = 0;
         if (AudioSource1 != null)
         {
             AudioSource1.loop = false;
             AudioSource1.Stop();
         }
     }
 }