Esempio n. 1
0
 void Update()
 {
     for (int i = 1; i < m_parameterList.Count; ++i)
     {
         FduAnimatorParameter para = m_parameterList[i];
         if (para.type == AnimatorControllerParameterType.Trigger && animator.GetBool(para.name))
         {
             triggerCacheList.Add(para.name);
         }
     }
 }
Esempio n. 2
0
 void switchCaseFunc(FduMultiAttributeObserverOP op, ref NetworkState.NETWORK_STATE_TYPE state)
 {
     for (int i = 0; i < m_parameterList.Count; ++i)
     {
         FduAnimatorParameter para = m_parameterList[i];
         if (para.type == AnimatorControllerParameterType.Bool) //参数为布尔类型
         {
             if (op == FduMultiAttributeObserverOP.SendData)
             {
                 BufferedNetworkUtilsServer.SendBool(animator.GetBool(para.name));
             }
             else if (op == FduMultiAttributeObserverOP.Receive_Direct || op == FduMultiAttributeObserverOP.Receive_Interpolation)
             {
                 animator.SetBool(para.name, BufferedNetworkUtilsClient.ReadBool(ref state));
             }
         }
         else if (para.type == AnimatorControllerParameterType.Trigger)//参数为trigger类型
         {
             if (op == FduMultiAttributeObserverOP.SendData)
             {
                 BufferedNetworkUtilsServer.SendBool(triggerCacheList.Contains(para.name));
             }
             else if (op == FduMultiAttributeObserverOP.Receive_Direct)
             {
                 animator.SetBool(para.name, BufferedNetworkUtilsClient.ReadBool(ref state));
             }
             else if (op == FduMultiAttributeObserverOP.Receive_Interpolation)
             {
                 bool triggerValue = BufferedNetworkUtilsClient.ReadBool(ref state);
                 if (triggerValue)
                 {
                     animator.SetTrigger(para.name);
                 }
                 else
                 {
                     animator.ResetTrigger(para.name);
                 }
             }
         }
         else if (para.type == AnimatorControllerParameterType.Int)//参数为int类型
         {
             if (op == FduMultiAttributeObserverOP.SendData)
             {
                 BufferedNetworkUtilsServer.SendInt(animator.GetInteger(para.name));
             }
             else if (op == FduMultiAttributeObserverOP.Receive_Direct)
             {
                 animator.SetInteger(para.name, BufferedNetworkUtilsClient.ReadInt(ref state));
             }
             else if (op == FduMultiAttributeObserverOP.Receive_Interpolation)
             {
                 setCachedProperty_append(i, BufferedNetworkUtilsClient.ReadInt(ref state));
             }
             else if (op == FduMultiAttributeObserverOP.Update)
             {
                 if (getCachedProperytyCount(i) > 0)
                 {
                     animator.SetInteger(para.name, FduInterpolationInterface.getNextIntValue_new(animator.GetInteger(para.name), i, this));
                 }
             }
         }
         else if (para.type == AnimatorControllerParameterType.Float)//参数为float类型
         {
             if (op == FduMultiAttributeObserverOP.SendData)
             {
                 BufferedNetworkUtilsServer.SendFloat(animator.GetFloat(para.name));
             }
             else if (op == FduMultiAttributeObserverOP.Receive_Direct)
             {
                 animator.SetFloat(para.name, BufferedNetworkUtilsClient.ReadFloat(ref state));
             }
             else if (op == FduMultiAttributeObserverOP.Receive_Interpolation)
             {
                 setCachedProperty_append(i, BufferedNetworkUtilsClient.ReadFloat(ref state));
             }
             else if (op == FduMultiAttributeObserverOP.Update)
             {
                 if (getCachedProperytyCount(i) > 0)
                 {
                     animator.SetFloat(para.name, FduInterpolationInterface.getNextFloatValue_new(animator.GetFloat(para.name), i, this));
                 }
             }
         }
     }
 }