public Buff(BuffVO vo, IBuffProperty property) { VO = vo; BuffProperty = property; // Cache m_SkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgSkillSystemProxy) as CfgSkillSystemProxy; m_GameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; Leyoutech.Utility.DebugUtility.LogWarning("Buff", string.Format("创建一个Buff ---> 归属entity = {0} , Buff ID = {1}", BuffProperty.EntityId(), VO.ID)); SkillBuff configVO = m_SkillProxy.GetBuff((int)VO.ID); if (configVO.ByteBuffer != null) { BuffEffect = BuffEffectBase.GetBuffEffectByType((BuffEffectType)configVO.BuffEffectId, this); Transform selfTf = BuffProperty.GetRootTransform(); SpacecraftEntity otherEntity = m_GameplayProxy.GetEntityById <SpacecraftEntity>(VO.Link_id) as SpacecraftEntity; Transform otherTf = null; if (otherEntity != null && !otherEntity.IsDead()) { otherTf = otherEntity.GetRootTransform(); } BuffEffect.Init(selfTf, otherTf); } else { BuffEffect = new BuffEffectBase(this); } }
//void FireBuff(SMsgActionWorldObjectAddBuff_SC evt) //{ // //Transform target = PlayerManager.Instance.FindPlayer(evt.SMsgActionSCHead.uidEntity).transform; // if (m_buffEffectList.ContainsKey(evt.dwIndex)) // { // ReleaseBuff(evt.dwIndex); // } // if (!m_handled) // { // m_handled = true; // LaunchBuff(evt); // } //} public void LaunchBuff(SMsgActionWorldObjectAddBuff_SC evt) { TypeID entityType; EntityModel entityTarget = EntityController.Instance.GetEntityModel(evt.SMsgActionSCHead.uidEntity, out entityType); if (entityTarget == null || entityTarget.GO == null) { return; } GameObject effectPrefab = BattleConfigManager.Instance.BuffConfigList[evt.dwBuffId]._buffEffectPrefab; if (null != effectPrefab) { Transform buffTarget = null; if (BattleConfigManager.Instance.BuffConfigList[evt.dwBuffId]._buffEffMount != "0") { entityTarget.GO.transform.RecursiveFindObject(BattleConfigManager.Instance.BuffConfigList[evt.dwBuffId]._buffEffMount, out buffTarget); if (buffTarget == null) { TraceUtil.Log(SystemModel.Common, TraceLevel.Error, "[buffTarget == null]"); buffTarget = entityTarget.GO.transform; } } else { buffTarget = entityTarget.GO.transform; } //add by lee : add sound if (BattleConfigManager.Instance.BuffConfigList[evt.dwBuffId]._buffSound != "0") { SoundManager.Instance.PlaySoundEffect(BattleConfigManager.Instance.BuffConfigList[evt.dwBuffId]._buffSound); } GameObject effectObj = GameObjectPool.Instance.AcquireLocal(effectPrefab, buffTarget.position, buffTarget.rotation); effectObj.transform.parent = buffTarget; effectObj.GetComponent <BuffEffectController>().Emit(); BuffEffectBase buffEffect = new BuffEffectBase(); buffEffect._effect = effectObj; buffEffect._buffID = evt.dwBuffId; BuffKey key = new BuffKey(); key.UID = evt.SMsgActionSCHead.uidEntity; key.Index = evt.dwIndex; m_buffEffectList.Add(key, buffEffect); } //PlaySoundEffect(evt.Param); }