Exemple #1
0
        public void OnMsg(EMsg msg, params object[] args)
        {
            switch (msg)
            {
            case EMsg.View_Prefab_Build:
                BiologyViewRoot viewRoot = (BiologyViewRoot)args[1];
                m_Barrel    = viewRoot.barrelController;
                m_BillBoard = viewRoot.billBoard;

                if (m_Target != null)
                {
                    m_Barrel.AimTarget = m_Target;
                }

                break;

            case EMsg.View_Model_Destroy:
                if (m_TowerEffect != null && m_TowerEffect.Count > 0)
                {
                    for (int i = 0; i < m_TowerEffect.Count; i++)
                    {
                        m_TowerEffect[i].Destroy();
                    }
                }
                break;

            default:
                break;
            }
        }
        GameObject BuildModelSync()
        {
            if (string.IsNullOrEmpty(prefabPath) /*|| null != mViewPrefab || null != mPrefabReq*/)
            {
                return(null);
            }

            GameObject tmpGo = AssetsLoader.Instance.InstantiateAssetImm(m_PrefabPath, Entity.peTrans.position, Entity.peTrans.rotation, Vector3.one);

            if (tmpGo == null)
            {
                return(null);
            }

            BiologyViewRoot   oldBiologyViewRoot = biologyViewRoot;
            PEModelController oldMonoModelCtrlr  = monoModelCtrlr;

            WhiteCat.BoneCollector oldMonoBoneCollector = monoBoneCollector;
            biologyViewRoot   = tmpGo.GetComponent <BiologyViewRoot>();
            monoModelCtrlr    = biologyViewRoot.modelController;
            monoBoneCollector = tmpGo.GetComponent <WhiteCat.BoneCollector>();

            GameObject tmpModel = monoModelCtrlr.gameObject;

            OnBoneLoadSync(tmpModel);

            // Recover
            biologyViewRoot   = oldBiologyViewRoot;
            monoModelCtrlr    = oldMonoModelCtrlr;
            monoBoneCollector = oldMonoBoneCollector;

            tmpModel.transform.SetParent(null, true);
            Destroy(tmpGo);
            return(tmpModel);
        }
Exemple #3
0
        void IPeMsg.OnMsg(EMsg msg, params object[] args)
        {
            switch (msg)
            {
            case EMsg.View_Prefab_Build:
                BiologyViewRoot viewRoot = args[1] as BiologyViewRoot;
                m_AnimEffectCtrl = viewRoot.ikAnimEffectCtrl;
                m_IKAimCtrl      = viewRoot.ikAimCtrl;
                m_IKFlashLight   = viewRoot.ikFlashLight;
                m_FBBIK          = viewRoot.fbbik;
                m_GroundFBBIK    = viewRoot.grounderFBBIK;
                m_IKArray        = viewRoot.ikArray;

                if (null != m_IKAimCtrl)
                {
                    m_IKAimCtrl.SetSmoothMoveState(m_SmoothAim);
                }
                m_AutoCloseFBBIK = (null == m_GroundFBBIK);
                if (null != m_FBBIK)
                {
                    m_FBBIK.Disable();
                    m_FBBIK.solver.iterations = 1;
                    m_DefaultMappingValue     = m_FBBIK.solver.leftArmMapping.weight;
                }
                if (null != m_GroundFBBIK)
                {
                    m_DefaultSpineBend = m_GroundFBBIK.spineBend;
                }

                ikEnable                  = m_IKEnable;
                flashLightActive          = m_FlashLightActive;
                enableArmMap              = m_SpineMask.Count == 0;
                enableGrounderSpineEffect = m_SpineMask.Count == 0;
                break;
//			case EMsg.Battle_EnterShootMode:
//				enableGrounderSpineEffect = false;
//				enableArmMap = false;
//				break;
//			case EMsg.Battle_ExitShootMode:
//				enableGrounderSpineEffect = true;
//				enableArmMap = true;
//				break;
//			case EMsg.Battle_PauseShootMode:
//				if(null != m_IKAimCtrl)
//					m_IKAimCtrl.SetActive(false);
//				break;
//			case EMsg.Battle_ContinueShootMode:
//				if(null != m_IKAimCtrl)
//					m_IKAimCtrl.SetActive(true);
//				break;
            }
        }
Exemple #4
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;
            }
        }
Exemple #5
0
        public void OnMsg(EMsg msg, params object[] args)
        {
            switch (msg)
            {
            case EMsg.View_Prefab_Build:
                BiologyViewRoot viewRoot = args[1] as BiologyViewRoot;
                m_Motor = viewRoot.motor;
                m_Steer = viewRoot.steerAgent;
                m_Path  = viewRoot.pathFinder;
                m_Param = viewRoot.beatParam;
                InitParam();

                if (m_Motor is PEMotorPhysics)
                {
                    (m_Motor as PEMotorPhysics).Init(Entity);
                }

                m_LastMoveTime = Time.time;
                break;

            case EMsg.Net_Controller:
                m_Proxy = false;
                break;

            case EMsg.Net_Proxy:
                m_Proxy = true;
                break;

            case EMsg.State_Die:
                if (m_Motor != null)
                {
                    m_Motor.Reset();
                }
                enabled = false;
                break;

            case EMsg.State_Revive:
                enabled = true;
                break;
            }
        }
Exemple #6
0
        public void OnMsg(EMsg msg, params object[] args)
        {
            switch (msg)
            {
            case EMsg.View_Prefab_Build:
                BiologyViewRoot viewRoot = args[1] as BiologyViewRoot;
                m_Param            = viewRoot.beatParam;
                m_PhyCtrl          = viewRoot.humanPhyCtrl;
                m_IKAnimCtrl       = viewRoot.ikAnimEffectCtrl;
                m_Repulsed.phyCtrl = m_PhyCtrl;
                m_Wentfly.phyCtrl  = m_PhyCtrl;
                m_Knocked.phyCtrl  = m_PhyCtrl;
                m_Repulsed.m_Param = m_Param;
                break;
//		    case EMsg.View_Ragdoll_Getup_Finished:
//				if(null != m_Wentfly && m_MotionMgr.IsActionRunning(m_Wentfly.ActionType))
//				m_MotionMgr.EndImmediately(m_Wentfly.ActionType);
//				m_MotionMgr.EndImmediately(m_Revive.ActionType);
//				m_MotionMgr.EndImmediately(m_GetUp.ActionType);
//				m_MotionMgr.EndImmediately(m_Knocked.ActionType);
//			    break;

            case EMsg.View_Ragdoll_Fall_Finished:
                if (null != m_PhyCtrl)
                {
                    m_PhyCtrl.grounded = true;
                }
                break;

            case EMsg.Battle_AttackHit:
                if (null != onHitTarget)
                {
                    PeEntity hitEntity = ((PECapsuleHitResult)args[0]).hitTrans.GetComponentInParent <PeEntity>();
                    onHitTarget(hitEntity);
                }
                break;
            }
        }