コード例 #1
0
 public override void ApplyAnim(string anim, SkRuntimeInfo info)
 {
     base.ApplyAnim(anim, info);
     if (anim == "Knock")
     {
         SkInst inst = info as SkInst;
         if (inst != null)
         {
             if (m_View != null && inst._colInfo != null && inst._colInfo.hitTrans != null && inst._colInfo.hitTrans.GetComponent <Rigidbody>() != null)
             {
                 //Vector3 direction = inst._colTarget.transform.position - inst._colCaster.transform.position;
                 RagdollHitInfo hitInfo = PETools.PE.CapsuleHitToRagdollHit(inst._colInfo);
                 if (m_View is BiologyViewCmpt)
                 {
                     (m_View as BiologyViewCmpt).ActivateRagdoll(hitInfo, true);
                 }
             }
         }
         else
         {
             Debug.LogError("[ApplyAnim] Unsupported SkRuntimeInfo type");
         }
     }
     else
     {
         if (m_Animator != null)
         {
             m_Animator.SetTrigger(anim);
         }
     }
 }
コード例 #2
0
        public void OnMsg(EMsg msg, params object[] args)
        {
            switch (msg)
            {
            case EMsg.Action_Knocked:
            case EMsg.Action_Repulsed:
            case EMsg.Action_Wentfly:
            case EMsg.Action_Whacked:
                m_Behave.Reset();
                m_SkEntity.CancelAllSkills();
                m_Animator.SetTrigger("Interrupt");
                break;

            case EMsg.View_Model_Build:
                //GameObject obj = args[0] as GameObject;
                BiologyViewRoot viewRoot = args[1] as BiologyViewRoot;
                m_Native = viewRoot.native;
                PEMotor m = viewRoot.motor;
                if (m_Trans != null && m_Animator != null && m != null && m_Motor != null && m_Motor.Field == MovementField.Sky)
                {
                    if (m.gravity > 0.0f)
                    {
                        m_IsFly = false;
                        m_Animator.SetBool("Fly", false);
                    }
                    else
                    {
                        m_IsFly = true;
                        m_Animator.SetBool("Fly", true);
                    }
                }

                PEMonster monster = viewRoot.monster;
                if (monster != null)
                {
                    m_IsDark = monster.isDark;
                }

                break;
            }
        }