//用于上层逻辑检查通过后调用 public void StartSkill(int actorId, int skillId, float facedir) { GameObject obj = LogicSystem.GetGameObject(actorId); if (null != obj) { SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.Sender == obj && info.SkillId == skillId); if (logicInfo != null) { return; } ChangeDir(obj, facedir); SkillInstanceInfo inst = NewSkillInstance(skillId); if (null != inst) { m_SkillLogicInfos.Add(new SkillLogicInfo(obj, inst)); } else { LogicSystem.NotifyGfxStopSkill(obj, skillId); return; } logicInfo = m_SkillLogicInfos.Find(info => info.Sender == obj && info.SkillId == skillId); if (null != logicInfo) { if (OnGfxShillStart != null) { OnGfxShillStart(obj, skillId); } LogicSystem.NotifyGfxAnimationStart(obj, true); logicInfo.SkillInst.Start(logicInfo.Sender); } } }
public void CameraFollowImmediately(int id) { UnityEngine.GameObject obj = LogicSystem.GetGameObject(id); if (null != obj) { m_CurTargetId = id; m_Target = obj.transform; UnityEngine.Collider collider = m_Target.GetComponent <UnityEngine.Collider>(); if (null != collider) { m_CurTargetPos = m_Target.position; m_CenterOffset = collider.bounds.center - m_Target.position; m_HeadOffset = m_CenterOffset; m_HeadOffset.y = collider.bounds.max.y - m_Target.position.y; m_IsFollow = true; Cut(); } else { m_IsFollow = false; } m_IsFollowEnable = true; m_IsShaking = false; } }
public void StopSkill(int actorId, bool isinterrupt) { GameObject obj = LogicSystem.GetGameObject(actorId); if (null == obj) { return; } int count = m_SkillLogicInfos.Count; for (int index = count - 1; index >= 0; --index) { SkillLogicInfo info = m_SkillLogicInfos[index]; if (info != null) { if (info.Sender == obj) { if (isinterrupt) { info.SkillInst.OnInterrupt(obj, 0); } else { info.SkillInst.OnSkillStop(obj, 0); } StopSkillInstance(info, isinterrupt); m_SkillLogicInfos.RemoveAt(index); } } } }
public override bool Execute(object sender, SkillInstance instance, long delta, long curSectionTime) { if (curSectionTime < m_StartTime) { return(true); } UnityEngine.GameObject obj = sender as UnityEngine.GameObject; if (obj == null) { return(false); } SharedGameObjectInfo owner_info = LogicSystem.GetSharedGameObjectInfo(obj); if (owner_info.Summons.Count <= 0) { return(false); } UnityEngine.GameObject first_summon = LogicSystem.GetGameObject(owner_info.Summons[0]); if (first_summon == null) { return(false); } UnityEngine.Vector3 summon_pos = first_summon.transform.position; first_summon.transform.position = obj.transform.position; obj.transform.position = summon_pos; LogicSystem.NotifyGfxUpdatePosition(obj, obj.transform.position.x, obj.transform.position.y, obj.transform.position.z); LogicSystem.NotifyGfxUpdatePosition(first_summon, first_summon.transform.position.x, first_summon.transform.position.y, first_summon.transform.position.z); return(false); }
private GameObject GetGameObjectByIndex(int index) { GameObject result = null; if (0 <= index && index < m_SummonList.Count) { result = LogicSystem.GetGameObject(m_SummonList[index]); } return(result); }
public void SendMessage(int actorId, int skillId, string msgId) { GameObject obj = LogicSystem.GetGameObject(actorId); if (null != obj) { SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.Sender == obj && info.SkillId == skillId); if (null != logicInfo && null != logicInfo.SkillInst) { logicInfo.SkillInst.SendMessage(msgId); } } }
public void StopGfxImpact(int objId, int impactId) { GameObject obj = LogicSystem.GetGameObject(objId); if (null != obj) { ImpactLogicInfo info = GetImpactInfoById(objId, impactId); if (null != info && info.IsActive) { IGfxImpactLogic logic = GfxImpactLogicManager.Instance.GetGfxImpactLogic(info.LogicId); logic.OnInterrupted(info); info.IsActive = false; } } }
private void SetTransformRelativeOwner(GameObject obj) { SharedGameObjectInfo shareobj = LogicSystem.GetSharedGameObjectInfo(obj); if (shareobj != null && shareobj.SummonOwnerActorId >= 0) { GameObject owner = LogicSystem.GetGameObject(shareobj.SummonOwnerActorId); if (owner == null) { return; } AttachToObjectForRandomRotate(obj, owner); } else { SetTransformRelativeSelf(obj); } }
//在技能未开始时取消技能(用于上层逻辑检查失败时) public void CancelSkill(int actorId, int skillId) { GameObject obj = LogicSystem.GetGameObject(actorId); if (null != obj) { SkillLogicInfo logicInfo = m_SkillLogicInfos.Find(info => info.Sender == obj && info.SkillId == skillId); if (null != logicInfo) { if (logicInfo.SkillInst.IsControlMove) { LogicSystem.NotifyGfxMoveControlFinish(obj, skillId, true); logicInfo.SkillInst.IsControlMove = false; } LogicSystem.NotifyGfxAnimationFinish(obj, true); RecycleSkillInstance(logicInfo.Info); m_SkillLogicInfos.Remove(logicInfo); } } }
public void SendDeadImpact(int targetId) { GameObject targetObj = LogicSystem.GetGameObject(targetId); if (null != targetObj) { bool needSendImpact = true; UnityEngine.Vector3 srcPos = UnityEngine.Vector3.zero; float srcDir = 0.0f; for (int i = m_ImpactLogicInfos.Count - 1; i >= 0; --i) { ImpactLogicInfo info = m_ImpactLogicInfos[i]; if (null != info) { if (info.IsActive) { if (info.Target.GetInstanceID() == targetObj.GetInstanceID()) { if (info.LogicId != (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Default) { IGfxImpactLogic logic = GfxImpactLogicManager.Instance.GetGfxImpactLogic(info.LogicId); if (null != logic) { logic.OnInterrupted(info); } needSendImpact = true; srcDir = info.ImpactSrcDir; srcPos = info.ImpactSrcPos; info.Recycle(); m_ImpactLogicInfos.RemoveAt(i); } } } } } if (needSendImpact) { SendImpactToCharacterImpl(targetObj, targetObj, m_DeadImpactId, srcPos.x, srcPos.y, srcPos.z, srcDir, -1); } } }
private void HandlerPlayParticle(int actorId) { UnityEngine.GameObject obj = LogicSystem.GetGameObject(actorId) as UnityEngine.GameObject; if (null != obj) { UnityEngine.Transform trans = GfxModule.Skill.Trigers.TriggerUtil.GetChildNodeByName(obj, "ef_head"); m_EfHeadTrans = CrossObjectHelper.TryCastObject <UnityEngine.Transform>(trans); if (trans != null && EffectForSpeaker != null) { if (m_RunTimeEffect == null) { m_RunTimeEffect = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.NewObject(EffectForSpeaker)); } if (m_RunTimeEffect != null) { m_RunTimeEffect.SetActive(true); m_RunTimeEffect.transform.position = new UnityEngine.Vector3(trans.position.x, trans.position.y, trans.position.z); } } } }
public static void GetProgenyGameObject(GameObject ancestor, List <GameObject> golist) { if (ancestor == null || golist == null) { return; } SharedGameObjectInfo sgoi = LogicSystem.GetSharedGameObjectInfo(ancestor); if (sgoi != null && sgoi.Summons != null) { int count = sgoi.Summons.Count; for (int i = 0; i < count; ++i) { GameObject go = LogicSystem.GetGameObject(sgoi.Summons[i]); if (go != null) { golist.Add(go); GetProgenyGameObject(go, golist); } } } }
public void TryPlaySound(int target, int impactId) { GameObject targetObj = LogicSystem.GetGameObject(target); if (null != targetObj) { SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(targetObj); if (null != shareInfo) { ImpactLogicData config = (ImpactLogicData)SkillConfigProvider.Instance.ExtractData(SkillConfigType.SCT_IMPACT, impactId); if (null != config) { int soundCount = shareInfo.HitSounds.Count; if (CrossEngineHelper.Random.NextFloat() < config.HitSoundProb && soundCount > 0) { string sound = shareInfo.HitSounds[CrossEngineHelper.Random.Next(soundCount)]; TryPlaySound(targetObj, sound); } } } } }
public void CameraFollow(int id) { GameObject obj = LogicSystem.GetGameObject(id); if (null != obj) { m_CurTargetId = id; m_Target = obj.transform; Collider collider = m_Target.collider; if (null != collider) { m_CenterOffset = collider.bounds.center - m_Target.position; m_HeadOffset = m_CenterOffset; m_HeadOffset.y = collider.bounds.max.y - m_Target.position.y; m_IsFollow = true; Cut(); } else { m_IsFollow = false; } } }
public static GameObject GetFinalOwner(GameObject source, int skillid, out int final_skillid) { SharedGameObjectInfo result = null; SharedGameObjectInfo si = LogicSystem.GetSharedGameObjectInfo(source); final_skillid = GetFinalSkill(source, skillid); int break_protector = 10000; while (si != null) { result = si; if (si.IsSummonWithAI) { break; } if (si.SummonOwnerActorId >= 0) { si = LogicSystem.GetSharedGameObjectInfo(si.SummonOwnerActorId); } else { break; } if (break_protector-- <= 0) { break; } } if (result != null) { return(LogicSystem.GetGameObject(result.m_ActorId)); } else { return(source); } }
public void CameraFollow(int id) { UnityEngine.GameObject obj = LogicSystem.GetGameObject(id); if (null != obj) { m_CurTargetId = id; m_Target = obj.transform; m_FixedRoll = 45; m_FixedYaw = 180; UnityEngine.Collider collider = m_Target.GetComponent <UnityEngine.Collider>(); if (null != collider) { m_CenterOffset = collider.bounds.center - m_Target.position; m_HeadOffset = m_CenterOffset; m_HeadOffset.y = collider.bounds.max.y - m_Target.position.y; m_IsFollow = true; Cut(); } else { m_IsFollow = false; } } }
private UnityEngine.Vector3 GetOwnerRandomPos(GameObject obj, UnityEngine.Vector3 center, float radius) { SharedGameObjectInfo obj_info = LogicSystem.GetSharedGameObjectInfo(obj); if (obj_info == null || obj_info.SummonOwnerActorId < 0) { return(obj.transform.position); } GameObject owner = LogicSystem.GetGameObject(obj_info.SummonOwnerActorId); if (owner == null) { return(obj.transform.position); } System.Random random = new System.Random(); float random_x = (float)(random.NextDouble() * radius); float random_z = (float)(random.NextDouble() * radius); UnityEngine.Vector3 random_pos = center; random_pos.x += random_x; random_pos.z += random_z; UnityEngine.Vector3 world_random_pos = owner.transform.TransformPoint(random_pos); return(CalcValidRandomPos(owner.transform.position, world_random_pos)); }
public void SetOwner(int id) { m_Owner = LogicSystem.GetGameObject(id); }
public void SendImpactToCharacter(int sender, int target, int impactId, float x, float y, float z, float dir, int forceLogicId) { GameObject senderObj = LogicSystem.GetGameObject(sender); GameObject targetObj = LogicSystem.GetGameObject(target); if (null == senderObj || null == targetObj) { LogSystem.Error("null obj"); } SharedGameObjectInfo targetInfo = LogicSystem.GetSharedGameObjectInfo(targetObj); if (null == targetInfo || targetInfo.IsDead) { return; } GfxImpactSoundManager.Instacne.TryPlaySound(target, impactId); ImpactLogicData config = (ImpactLogicData)SkillConfigProvider.Instance.ExtractData(SkillConfigType.SCT_IMPACT, impactId); if (null != config) { if (config.MoveMode == (int)ImpactMovementType.Inherit) { GetPreImpactMoveInfo(targetObj, out x, out y, out z, out dir); } bool needSendImpact = true; int logicId = config.ImpactGfxLogicId; if (-1 != forceLogicId) { logicId = forceLogicId; } for (int i = m_ImpactLogicInfos.Count - 1; i >= 0; --i) { ImpactLogicInfo info = m_ImpactLogicInfos[i]; if (null != info) { if (info.IsActive) { if (info.Target.GetInstanceID() == targetObj.GetInstanceID()) { if (info.LogicId == (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Default || logicId == (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Default) { if (info.ImpactId != impactId) { continue; } } IGfxImpactLogic logic = GfxImpactLogicManager.Instance.GetGfxImpactLogic(info.LogicId); if (null != logic) { needSendImpact = logic.OnOtherImpact(logicId, info, (info.ImpactId == impactId)); if (needSendImpact) { info.Recycle(); m_ImpactLogicInfos.RemoveAt(i); } } } } } } if (needSendImpact) { SendImpactToCharacterImpl(senderObj, targetObj, impactId, x, y, z, dir, forceLogicId); } else { LogicSystem.NotifyGfxStopImpact(senderObj, impactId, targetObj); } } }
public static void MoveChildToNode(int actorid, string childname, string nodename) { GameObject obj = LogicSystem.GetGameObject(actorid); MoveChildToNode(obj, childname, nodename); }