private static List <MyLauncherVO> GetShipLauncher(CSVReader excelWriter, string shipPrefabPath, List <string> errorList) { // AssetPath GameObject ship = AssetDatabase.LoadAssetAtPath <GameObject>(shipPrefabPath); Debug.Log(ship.name); SpacecraftPresentation socketContainer = ship.GetComponent <SpacecraftPresentation>(); if (socketContainer == null) { errorList.Add("Prefab: " + shipPrefabPath + " 上没有挂载 SpacecraftPresentation, 无法导出技能释放点信息."); Debug.LogWarningFormat("Prefab: {0} 上没有挂载 SpacecraftPresentation, 无法导出技能释放点信息.", shipPrefabPath); return(null); } List <MyLauncherMergeVO> launcherMergeList = new List <MyLauncherMergeVO>(); // 输出所有武器的挂点信息 launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.WeaponMain, socketContainer.socket_main)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.WeaponSub, socketContainer.socket_secondary)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.WeaponSuper, socketContainer.socket_super)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.WeaponFurnace, socketContainer.socket_furnace)); // 输出所有技能点的挂点信息 launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.Center, socketContainer.socket_skill_center)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.QuickFirer, socketContainer.socket_skill_quickFirer)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.Cannon, socketContainer.socket_skill_cannon)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.RailGun, socketContainer.socket_skill_railGun)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.Rocket, socketContainer.socket_skill_rocket)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.Missile, socketContainer.socket_skill_missile)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.Torpedo, socketContainer.socket_skill_torpedo)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.Laser, socketContainer.socket_skill_laser)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.Electromagnetism, socketContainer.socket_skill_electromagnetism)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.Particle, socketContainer.socket_skill_particle)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.SkillA, socketContainer.socket_skill_skillA)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.SkillB, socketContainer.socket_skill_skillB)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.SkillC, socketContainer.socket_skill_skillC)); launcherMergeList.Add(TransformToLauncherMergeVO(SkillLaunchPoint.SkillD, socketContainer.socket_skill_skillD)); // 找到所有使用这个Prefab的Module, 记录他们的ModuleID List <int> moduleIDList = new List <int>(); int rowCount = excelWriter.GetRowCount(); for (int iRow = 1; iRow <= rowCount; iRow++) { if (excelWriter.GetCellText(iRow, 3) != "1") { continue; } if (excelWriter.GetCellText(iRow, 4) == FileUtility.ExtractFileNameFromAbsolutePath(shipPrefabPath)) { string strIndex = excelWriter.GetCellText(iRow, 1); int index = Int32.Parse(strIndex); moduleIDList.Add(index); } } // 每个Module弄一个 MyLauncherVO List <MyLauncherVO> launcherVOList = new List <MyLauncherVO>(); for (int iModule = 0; iModule < moduleIDList.Count; iModule++) { MyLauncherVO launcherVO = new MyLauncherVO(); launcherVO.ID = moduleIDList[iModule]; launcherVO.LauncherMergeVOList = launcherMergeList; launcherVOList.Add(launcherVO); } return(launcherVOList); }
//private void OnCollisionEnter(Collision obj) //{ // OnSpacecraftSlidingEnd(); //} //private void OnCollisionStay(Collision obj) //{ //} //private void OnCollisionExit(Collision obj) //{ //} //private void OnRelive(IComponentEvent obj) //{ // m_DeadFxState = DeadState.None; // RealTimerUtil.Instance.Unregister(m_ShowDeadFxTimerId); //} private void OnDead(IComponentEvent obj) { DeadEvent deadEvent = obj as DeadEvent; if (!m_SpacecraftDeadProperty.IsDead()) { return; } m_DropInfoList = deadEvent.DropList; /// TODO.宝藏特殊处理 /// 服务器创建后立马死亡 //if (m_SpacecraftDeadProperty.IsNotHaveAva()) //{ // if (m_DropInfoList != null && m_DropInfoList.Count > 0) // { // DropItemManager.Instance.SetDropItemInfoByDeath(m_SpacecraftDeadProperty.UId(), m_DropInfoList); // } // return; //} /// npc死亡 if (m_SpacecraftDeadProperty.GetHeroType() != KHeroType.htPlayer) { Npc npcVO = m_SpacecraftDeadProperty.GetNPCTemplateVO(); if (npcVO.SoundDead > 0) { SendEvent(ComponentEventName.PlaySound, new PlaySound() { SoundID = (int)npcVO.SoundDead }); } /// 导演死检查音乐盒子 if (m_SpacecraftDeadProperty.GetHeroType() == KHeroType.htPlotMonster) { MSAIBossProxy msab = GameFacade.Instance.RetrieveProxy(ProxyName.MSAIBossProxy) as MSAIBossProxy; msab.DestroySoundBox(m_SpacecraftDeadProperty.UId()); } /// TODO.干扰器死亡 else if (m_SpacecraftDeadProperty.GetHeroType() == KHeroType.htDisturbor) { /// 自己的停掉 SpacecraftEntity ownerEntity = m_SpacecraftDeadProperty.GetOwner(); ownerEntity.SendEvent(ComponentEventName.PlaySound, new PlaySound() { SoundID = (int)WwiseMusic.Treasure_Disturbor_Sound5, Transform = ownerEntity.GetSkinTransform() }); TreasureHuntProxy treasure = GameFacade.Instance.RetrieveProxy(ProxyName.TreasureHuntProxy) as TreasureHuntProxy; treasure.DisturborSoundEffect(m_SpacecraftDeadProperty.GetOwner().m_EntityFatherOwnerID); } } m_SpacecraftDeadProperty.SetTarget(null, null); #region 待服务器在new_hero协议中添加复活状态逻辑后删除 if (m_SpacecraftDeadProperty.IsMain()) { m_GameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; if (m_SpacecraftDeadProperty.IsMain()) { CfgEternityProxy eternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; m_GameplayProxy.SetDeadMapID(eternityProxy.GetCurrentMapData().GamingmapId); } } #endregion ShowRelivePanel(deadEvent); SpacecraftPresentation presentation = m_SpacecraftDeadProperty.GetPresentation(); if (presentation != null) { if (presentation.SpacecraftDeadType != SpacecraftPresentation.SpacecraftType.Warship) { OnDeviceDead(deadEvent); } } }
private void OnSpacecraftAvatarLoadFinishEvent(IComponentEvent componentEvent) { AvatarLoadFinishEvent spacecraftAvatarLoadFinishEvent = componentEvent as AvatarLoadFinishEvent; m_SpacecraftHnagingPointList = spacecraftAvatarLoadFinishEvent.SpacecraftPresentation; m_Animator = spacecraftAvatarLoadFinishEvent.Animator; Animator[] animators = spacecraftAvatarLoadFinishEvent.Animators; for (int i = 0; i < animators.Length; i++) { // TODO. // 先以命名为规则 if (animators[i].transform.name.Contains("_action")) { m_StateAnimator = animators[i]; AnimationClip[] animationClips = m_StateAnimator.runtimeAnimatorController.animationClips; AnimatorOverrideController animatorOverrideController; animatorOverrideController = new AnimatorOverrideController(m_StateAnimator.runtimeAnimatorController); m_StateAnimator.runtimeAnimatorController = animatorOverrideController; EnumMainState state = m_SpacecraftPlayerAnimatorProperty.GetCurrentState().GetMainState(); if (state == EnumMainState.Fight) { for (int j = 0; j < animationClips.Length; j++) { // TODO. if (animationClips[j].name.Contains("_attacked")) { animatorOverrideController["DefaultState"] = animationClips[j]; break; } } } else { for (int j = 0; j < animationClips.Length; j++) { // TODO. if (animationClips[j].name.Contains("_normal_state")) { animatorOverrideController["DefaultState"] = animationClips[j]; break; } } } break; } } //播放尾焰音效 if (m_SpacecraftPlayerAnimatorProperty != null) { WwiseUtil.PlaySound(m_musicComboID, WwiseMusicSpecialType.SpecialType_WarShipEngine_1, m_IsMain ? WwiseMusicPalce.Palce_1st : WwiseMusicPalce.Palce_3st, false, m_SpacecraftPlayerAnimatorProperty.GetRootTransform()); } if (m_IsMain) { //添加速度线 if (!m_LeapCamera) { m_LeapCamera = EffectManager.GetInstance().CreateEffect( Leyoutech.Core.Loader.Config.AssetAddressKey.FX_SOCKET_FX_CAMERA , EffectManager.GetEffectGroupNameInSpace(m_IsMain) , OnLeapCameraCreated, this); m_LeapCamera.transform.SetParent(m_SpacecraftPlayerAnimatorProperty.GetOwner().GetSkinRootTransform(), false); m_LeapCamera.SetCreateForMainPlayer(m_IsMain); m_LeapCamera.SetAutoRecycleWhenNotExistLivingParticles(false); } m_LeapCamera.PlayFX(); } }
/// <summary> /// 飞船模型载入完毕 /// </summary> /// <param name="asyncOperation"></param> private void OnLoadModel(GameObject asyncOperation, string path) { m_Model = asyncOperation; if (m_Model == null) { throw new System.Exception("m_Model is null"); } if (!asyncOperation.IsPooled()) { asyncOperation.CreatePool(1, path); } m_Model = asyncOperation.Spawn(m_Property.GetSkinRootTransform()); if (m_Model.transform.parent == null) { m_Model.Recycle(); return; } m_Model.transform.localPosition = Vector3.zero; m_Model.transform.localRotation = Quaternion.identity; m_Model.transform.localScale = Vector3.one; m_Property.SetSkinTransform(m_Model.transform); SendEvent(ComponentEventName.AvatarLoadFinish, new AvatarLoadFinishEvent() { SpacecraftPresentation = m_Model.GetComponentInChildren <SpacecraftPresentation>(), Animator = m_Model.GetComponentInChildren <Animator>(), Animators = m_Model.GetComponentsInChildren <Animator>() }); if (m_Property.GetHeroType() == KHeroType.htDetector) { SendEvent(ComponentEventName.OnGetMeshRenderer, new GetMeshRendererEvent() { MeshRenderer = m_Model.GetComponentInChildren <MeshRenderer>(), /// TODO. Transform = m_Model.transform.Find("Effect_A") }); } int spacecraftLayer = LayerUtil.GetLayerByHeroType(m_Property.GetHeroType(), m_Property.IsMain()); LayerUtil.SetGameObjectToLayer(m_Model, spacecraftLayer, true); if (m_Property.GetSyncTarget() != null) { LayerUtil.SetGameObjectToLayer(m_Property.GetSyncTarget().gameObject, spacecraftLayer, true); } m_Presentation = m_Model.GetComponent <SpacecraftPresentation>(); if (m_Presentation == null) { Debug.LogWarning(string.Format("这个错误不可忽略! 飞船 {0} 没有挂点和表现信息, 找美术加上.", m_Model.name)); } else { m_Property.SetPresentation(m_Presentation); // 复制一份CapsuleCollider给同步模块使用. 这个复制出来的CapsuleCollider不会被LODSwitchItem影响, 所以不会被Disable // 只有玩家才会与场景碰撞. 怪物和NPC都不与场景碰撞. 程旭与王梓晨商议决定 if (m_Property.GetHeroType() == KHeroType.htPlayer) { CapsuleCollider capsuleCollider = m_Presentation.GetCapsuleCollider(); if (capsuleCollider == null) { Debug.LogError(string.Format("这个错误不可忽略! 飞船 {0} 没有胶囊碰撞体, 找美术加上.", m_Model.name)); } GameObject colliderCopy = GameObject.Instantiate(capsuleCollider.gameObject, m_Property.GetSyncTarget()); colliderCopy.transform.position = capsuleCollider.transform.position; colliderCopy.transform.rotation = capsuleCollider.transform.rotation; colliderCopy.name = string.Format("{0}_ForMotionSync", capsuleCollider.name); LayerUtil.SetGameObjectToLayer(colliderCopy, GameConstant.LayerTypeID.ServerSynchronization, false); } else { if (m_Property.GetHeroType() == KHeroType.htMine) { List <Collider> capsuleColliders = m_Presentation.GetAllCapsuleColliders(); if (capsuleColliders != null) { foreach (var item in capsuleColliders) { item.gameObject.layer = GameConstant.LayerTypeID.SkillCrossSpacecraftBlock; } } } //if (EffectUtility.IsEffectNameValid(m_Presentation.BirthFXAddress)) //{ // EffectController BirthFX = EffectManager.GetInstance().CreateEffect(m_Presentation.BirthFXAddress, EffectManager.GetEffectGroupNameInSpace(false), OnLoadBrithFXComplete,this); // BirthFX.transform.SetParent(m_Property.GetSkinRootTransform(), false); // BirthFX.SetCreateForMainPlayer(false); // m_Presentation.SetVisibilityOfEntireSpacecraft(false); //} m_ModelLoadCompleteInThisFrame = true; m_TimeOfModelLoadComplete = Time.time; } //if (m_Died && m_Presentation.DeathFXAddressList != null && m_Presentation.DeathFXAddressList.Count != 0) //{ // EffectController deathFX = EffectManager.GetInstance().CreateEffect(m_Presentation.DeathFXAddressList[m_DeathFXIndex], EffectManager.GetEffectGroupNameInSpace(false)); // deathFX.transform.SetParent(m_Property.GetSkinRootTransform(), false); // deathFX.SetCreateForMainPlayer(false); //} } UpdateVisibility(); UpdateEnableOfAllCollider(); UpdateColliderLOD(true); if (m_Property.IsDead()) { m_Property.SetSkinVisiable(false); } /// 是探测器 if (m_Property.GetOwner().m_EntityFatherOwnerID != 0 && m_Property.GetHeroType() == KHeroType.htDisturbor && !m_Property.IsDead()) { AddLineEffect(); } /// 封印 if (m_Property.IsSeal()) { AddHideEffect(); } /// Npc出生音乐 if (m_Property.GetHeroType() != KHeroType.htPlayer) { Npc npcVO = m_Property.GetNPCTemplateVO(); if (npcVO.SoundAlive > 0) { SendEvent(ComponentEventName.PlaySound, new PlaySound() { SoundID = (int)npcVO.SoundAlive }); } } }