private void Update() { if (Time.time > m_sinkStartTime) { Vector3 position = transform.position; position.y -= Time.deltaTime * 0.19f; transform.position = position; if (!m_isSinkStarted) { m_isSinkStarted = true; AudioController.Play("CorpseDisapear", transform); } } if (m_skullsFx == null && Time.time > m_startSkullFxTime) { Vector3 vector = transform.position; FXTags componentInChildren = GetComponentInChildren <FXTags>(); if (componentInChildren != null) { vector = componentInChildren.GetAveragePoint("HitSpot"); if (vector == Vector3.zero) { vector = transform.position; } } UnityEngine.Object original = Resources.Load("FX/FX_DieSkulls"); m_skullsFx = (GameObject)Instantiate(original, vector, Quaternion.identity); Destroy(m_skullsFx, 30f); } if (Time.time > m_sinkStartTime + 7f && m_skullsFx.GetComponent <ParticleEmitter>().emit) { m_skullsFx.GetComponent <ParticleEmitter>().emit = false; } }
private void Start() { target = gameObject; getTarget(); StartCoroutine(HitAnim()); CombatViewBase component = GetComponent <CombatViewBase>(); Transform parent = transform.parent; while (parent != null && (component = parent.GetComponent <CombatViewBase>()) == null) { parent = parent.parent; } if (component != null) { m_listener = component.gameObject.AddComponent <MonsterEventListener>(); m_listener.SetEventListener(this); FXTags component2 = component.GetComponent <FXTags>(); if (component2 != null) { m_hitSpots = component2.Find("HitSpot"); if (m_hitSpots == null || m_hitSpots.Length == 0) { m_hitSpots = new GameObject[] { gameObject }; } } } else { Debug.LogError("CelestialArmorMonsterBuffFX: CombatViewBase not found!"); } }
public override void Begin(Single p_lifetime, FXArgs p_args) { base.Begin(p_lifetime, p_args); Transform transform; if (!String.IsNullOrEmpty(m_Tag)) { FXTags component = p_args.Origin.GetComponent <FXTags>(true); if (component == null) { Debug.Log("Effect require FXTags component on " + p_args.Origin, p_args.Origin); ForceFinish(); return; } transform = component.FindOne(m_Tag).transform; } else { transform = p_args.BeginPointTransform; } m_Start = transform.position; m_StartTangent = p_args.EndPointTransform.position - m_Start; Single magnitude = m_StartTangent.magnitude; m_StartTangent.Normalize(); m_StartTangent = Quaternion.LookRotation(m_StartTangent) * Quaternion.Euler(-Random.Range(m_CurveVertical.x, m_CurveVertical.y), Random.Range(m_CurveHorizontal.x, m_CurveHorizontal.y), 0f) * new Vector3(0f, 0f, magnitude); m_TimeLength = magnitude / (m_Speed + Single.Epsilon); m_FinishMoveTime = Time.time + m_TimeLength; GameObject gameObject = Helper.Instantiate <GameObject>(m_Prefab, m_Start); m_Instance = gameObject.transform; m_Instance.localScale = m_Scale; if (!String.IsNullOrEmpty(m_StartSound)) { AudioController.Play(m_StartSound, m_Start, null); } if (!String.IsNullOrEmpty(m_FlightLoopSound)) { m_LoopSound = AudioController.Play(m_FlightLoopSound, m_Instance); } Single z; Single x; if (5f > Mathf.Abs(Vector3.Distance(transform.position + new Vector3(5f, m_TargetOffset_Y, 0f), p_args.EndPointTransform.position) - Vector3.Distance(transform.position + new Vector3(-5f, m_TargetOffset_Y, 0f), p_args.EndPointTransform.position))) { z = 0f; x = Random.Range(-5, 5); } else { x = 0f; z = Random.Range(-5, 5); } m_TargetOffset = new Vector3(x, m_TargetOffset_Y, z); Update(); SendBroadcastBeginEffect <UnityEventArgs <FXArgs> >(gameObject, new UnityEventArgs <FXArgs>(this, p_args)); }
public override void Begin(Single p_lifetime, FXArgs p_args) { base.Begin(p_lifetime, p_args); m_SpawnPerTarget = Math.Max(m_SpawnPerTarget, 1); UnityEventArgs <FXArgs> p_args2 = new UnityEventArgs <FXArgs>(this, p_args); if (m_ImpactPrefab != null) { GameObject gameObject = Helper.Instantiate <GameObject>(m_ImpactPrefab, p_args.TargetTransform.position); if (m_AttachToTransform) { gameObject.transform.parent = p_args.TargetTransform; } m_Instance = gameObject; SendBroadcastBeginEffect <UnityEventArgs <FXArgs> >(gameObject, p_args2); } if (p_args.Targets != null && m_TargetsImpactPrefab != null) { m_TargetInstances = new List <GameObject>(p_args.Targets.Count); foreach (GameObject gameObject2 in p_args.Targets) { Transform transform = gameObject2.transform; GameObject gameObject; if (!String.IsNullOrEmpty(m_TargetsTag)) { FXTags component = gameObject2.GetComponent <FXTags>(); if (component != null) { GameObject[] array = component.Find(m_TargetsTag); if (array.Length > 1) { for (Int32 i = 0; i < m_SpawnPerTarget; i++) { transform = array.RandomElement <GameObject>().transform; gameObject = Helper.Instantiate <GameObject>(m_TargetsImpactPrefab, transform.position); if (m_AttachToTargetTransforms) { gameObject.transform.parent = transform; } m_TargetInstances.Add(gameObject); SendBroadcastBeginEffect <UnityEventArgs <FXArgs> >(gameObject, p_args2); } continue; } transform = array.RandomElement <GameObject>().transform; } } gameObject = Helper.Instantiate <GameObject>(m_TargetsImpactPrefab, transform.position); if (m_AttachToTargetTransforms) { gameObject.transform.parent = transform; } m_TargetInstances.Add(gameObject); SendBroadcastBeginEffect <UnityEventArgs <FXArgs> >(gameObject, p_args2); } } }
public override void Begin(Single p_lifetime, FXArgs p_args) { base.Begin(p_lifetime, p_args); if (m_ImpactPrefab != null) { UnityEventArgs <FXArgs> p_args2 = new UnityEventArgs <FXArgs>(this, p_args); Transform transform = null; FXTags component = p_args.Origin.GetComponent <FXTags>(); if (component != null) { GameObject gameObject = component.FindOne("CastSpot"); if (gameObject != null) { transform = gameObject.transform; } } GameObject gameObject2; if (transform != null) { gameObject2 = Helper.Instantiate <GameObject>(m_ImpactPrefab, transform.transform.position); transform.AddChildAlignOrigin(gameObject2.transform); } else { gameObject2 = Helper.Instantiate <GameObject>(m_ImpactPrefab, p_args.OriginTransform.position); } m_Instance = gameObject2; ChainLightning component2 = m_Instance.GetComponent <ChainLightning>(); if (p_args.Targets != null) { foreach (GameObject gameObject3 in p_args.Targets) { if (!String.IsNullOrEmpty(m_TargetsTag)) { FXTags component3 = gameObject3.GetComponent <FXTags>(); if (component3 != null) { component2.Targets.Add(component3.FindOne(m_TargetsTag)); } else { component2.Targets.Add(gameObject3); } } else { component2.Targets.Add(gameObject3); } } } else { component2.Targets.Add(p_args.Target); } SendBroadcastBeginEffect <UnityEventArgs <FXArgs> >(gameObject2, p_args2); } }
private void OnBeginEffect(UnityEventArgs <FXArgs> e) { FXTags component = e.EventArgs.Target.GetComponent <FXTags>(); Transform transform; if (component == null) { Debug.LogError("FXTags not found at model " + e.EventArgs.Target, e.EventArgs.Target); transform = e.EventArgs.TargetTransform; } else { transform = component.FindOne(m_Tag).transform; } this.transform.position = transform.position; if (m_AttackToTransform) { this.transform.parent = transform; } }
public void PartyCastSpell(ETarget wizard, TestSpell spell) { m_LastSpellIsMonster = false; m_LastSpell = spell; m_TargetOrWizard = wizard; if (!String.IsNullOrEmpty(spell.EffectPath)) { FXQueue fxqueue = Helper.ResourcesLoad <FXQueue>(spell.EffectPath, false); if (fxqueue != null && m_ActiveMonster != null) { if (wizard == ETarget.Party) { wizard = (ETarget)UnityEngine.Random.Range(1, 4); } GameObject gameObject; switch (wizard) { case ETarget.Member1: gameObject = m_Member1; break; case ETarget.Member2: gameObject = m_Member2; break; case ETarget.Member3: gameObject = m_Member3; break; case ETarget.Member4: gameObject = m_Member4; break; default: return; } Vector3 forward = m_Party.transform.forward; Vector3 p_slotLeft = -m_Party.transform.right; ETargetType targetType = spell.TargetType; FXArgs args; if ((targetType & ETargetType.PARTY) == ETargetType.PARTY) { args = new FXArgs(m_PartySlot, m_PartySlot, m_PartySlot, m_PartySlot, m_PartySlot.transform.position, forward, p_slotLeft, m_PartySlot.transform.position, new List <GameObject> { m_PartySlot }); } else if ((targetType & ETargetType.LINE_OF_SIGHT) == ETargetType.LINE_OF_SIGHT) { args = new FXArgs(m_PartySlot, m_MonsterSlot, m_PartySlot, m_MonsterSlot, m_PartySlot.transform.position, forward, p_slotLeft, m_MonsterSlot.transform.position, new List <GameObject> { m_ActiveMonster }); } else if ((targetType & ETargetType.MULTY) == ETargetType.MULTY) { args = new FXArgs(gameObject, m_MonsterSlot, gameObject, m_MonsterSlot, m_PartySlot.transform.position, forward, p_slotLeft, m_MonsterSlot.transform.position, new List <GameObject> { m_ActiveMonster }); } else if ((targetType & ETargetType.SINGLE) == ETargetType.SINGLE) { FXTags component = m_ActiveMonster.GetComponent <FXTags>(); GameObject p_endPoint = m_ActiveMonster; if (component != null) { p_endPoint = component.FindOne("HitSpot"); } else { Debug.LogError("FXTags not found!!\nTarget=" + m_ActiveMonster, m_ActiveMonster); } args = new FXArgs(gameObject, m_MonsterSlot, gameObject, p_endPoint, m_PartySlot.transform.position, forward, p_slotLeft, m_MonsterSlot.transform.position, new List <GameObject> { m_ActiveMonster }); } else if ((targetType & ETargetType.ADJACENT) == ETargetType.ADJACENT) { args = new FXArgs(gameObject, m_PartySlot, gameObject, m_PartySlot, m_PartySlot.transform.position, forward, p_slotLeft, m_MonsterSlot.transform.position, new List <GameObject> { m_ActiveMonster }); } else { Debug.LogError("error !! spellType: " + targetType); args = new FXArgs(gameObject, m_ActiveMonster, gameObject, m_ActiveMonster, m_PartySlot.transform.position, forward, p_slotLeft, m_MonsterSlot.transform.position, new List <GameObject> { m_ActiveMonster }); } FXQueue fxqueue2 = Helper.Instantiate <FXQueue>(fxqueue); fxqueue2.Finished += delegate(Object sender, EventArgs e) { m_ActiveMonsterAnimationHandler.Hit(); }; fxqueue2.Execute(args); } else { Debug.LogError("SpellEffect not found! " + spell.EffectPath); } } PartyCastBuff(spell); MonsterCastBuff(spell); }
private void OnCharacterAttacksRanged(Object p_sender, EventArgs p_args) { AttacksEventArgs attacksEventArgs = (AttacksEventArgs)p_args; if (attacksEventArgs.Attacks.Count == 0) { OnCharacterFXDone(p_sender, p_args); return; } Character character = (Character)p_sender; Boolean flag = true; foreach (AttacksEventArgs.AttackedTarget attackedTarget in attacksEventArgs.Attacks) { Monster monster = (Monster)attackedTarget.AttackTarget; EResultType result = attackedTarget.AttackResult.Result; FXQueue rangedFX = GetRangedFX(attacksEventArgs.IsTryingToPushToParty, character, result); if (rangedFX != null) { Vector3 p_slotOriginPosition; Vector3 p_slotForward; Vector3 p_slotLeft; Vector3 p_slotTargetPosition; ViewManager.GetSlotDatas(((Party)MyController).Position, monster.Position, out p_slotOriginPosition, out p_slotForward, out p_slotLeft, out p_slotTargetPosition); GameObject memberGameObject = m_PartyView.GetMemberGameObject(character.Index); GameObject gameObject = null; GameObject gameObject2 = null; if (result == EResultType.EVADE) { gameObject = ViewManager.Instance.FindView(monster); gameObject2 = new GameObject("Miss hit point on the ground"); Destroy(gameObject2, 30f); gameObject2.transform.position = gameObject.transform.position + (transform.position - gameObject.transform.position).normalized + transform.right * 2f * (UnityEngine.Random.value - 0.5f); } else { FXTags fxtags = ViewManager.Instance.FindViewAndGetComponent <FXTags>(monster); if (fxtags != null) { gameObject = fxtags.gameObject; gameObject2 = fxtags.FindOne((result != EResultType.BLOCK) ? "HitSpot" : "BlockHitSpot"); } } if (memberGameObject == null || gameObject == null || gameObject2 == null) { if (flag) { OnRangedFXHit(p_sender, p_args); } OnCharacterFXDone(p_sender, p_args); Debug.LogError(String.Concat(new Object[] { "Attacker/Target not found!\nAttacker=", memberGameObject, "\ntargetGO=", gameObject, "\nfxEndpointGO=", gameObject2 })); break; } FXArgs args = new FXArgs(memberGameObject, gameObject, memberGameObject, gameObject2, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition); FXQueue fxqueue = Helper.Instantiate <FXQueue>(rangedFX); fxqueue.Execute(args); if (flag) { flag = false; fxqueue.Finished += delegate(Object o, EventArgs e) { OnRangedFXHit(p_sender, p_args); }; } } else { if (flag) { flag = false; OnRangedFXHit(p_sender, p_args); } OnCharacterFXDone(p_sender, p_args); Debug.LogError("Ranged FX(" + result + ") missing!"); } } }
public override void Begin(Single p_lifetime, FXArgs p_args) { base.Begin(p_lifetime, p_args); GameObject gameObject = p_args.Origin; m_isSlotPos = false; if (m_SpawnTarget == ETarget.TARGET) { gameObject = p_args.Target; m_isSlotPos = false; } else if (m_SpawnTarget == ETarget.SLOT_ORIGIN) { targetpos = p_args.SlotOriginPosition; m_isSlotPos = true; } else if (m_SpawnTarget == ETarget.SLOT_TARGET) { targetpos = p_args.SlotTargetPosition; m_isSlotPos = true; } m_Instances = new List <GameObject>(); if (!String.IsNullOrEmpty(m_Tag)) { FXTags component = gameObject.GetComponent <FXTags>(); if (component != null) { GameObject[] array = component.Find(m_Tag); m_Instances.Capacity = array.Length; m_Instances.AddRange(array); } else { m_Instances.Add(gameObject); } } else { m_Instances.Add(gameObject); } Quaternion quaternion = Quaternion.LookRotation(p_args.SlotForward); UnityEventArgs <FXArgs> p_args2 = new UnityEventArgs <FXArgs>(this, p_args); for (Int32 i = 0; i < m_Instances.Count; i++) { if (!(m_Instances[i] == null)) { Transform transform = m_Instances[i].transform; GameObject gameObject2; if (!m_isSlotPos) { gameObject2 = Helper.Instantiate <GameObject>(m_Prefab, transform.position, (!m_InheritTransformRotation) ? quaternion : transform.rotation); } else { gameObject2 = Helper.Instantiate <GameObject>(m_Prefab, targetpos, quaternion); } if (m_AttachToTransform) { transform.AddChild(gameObject2.transform); } SendBroadcastBeginEffect <UnityEventArgs <FXArgs> >(gameObject2, p_args2); m_Instances[i] = gameObject2; } } }
private void OnCharacterCastSpell(Object p_sender, EventArgs p_args) { Character character = (Character)p_sender; SpellEventArgs spellEventArgs = (SpellEventArgs)p_args; if (character != null) { SpellEffectEntryEventArgs p_args2 = new SpellEffectEntryEventArgs(p_sender, (SpellEventArgs)p_args); character.FightHandler.FeedDelayedActionLog(p_args2); } if (spellEventArgs.SpellTargets.Count == 0) { OnFXCancel(p_sender, p_args); return; } FXQueue fxqueue = Helper.ResourcesLoad <FXQueue>(spellEventArgs.Spell.EffectKey, false); if (fxqueue == null) { Debug.LogError(String.Concat(new Object[] { "PlayerSpellView: OnCharacterCastSpell: Character FXQueue not found! at '", spellEventArgs.Spell.EffectKey, "' ", spellEventArgs })); OnFXCancel(p_sender, p_args); return; } Party party = (Party)MyController; List <GameObject> list = new List <GameObject>(spellEventArgs.SpellTargets.Count); foreach (SpellTarget spellTarget in spellEventArgs.SpellTargets) { if (spellTarget.Target is Character) { Character character2 = (Character)spellTarget.Target; GameObject characterGO = FXHelper.GetCharacterGO(character2.Index); if (!list.Contains(characterGO)) { list.Add(characterGO); } } else { GameObject gameObject = ViewManager.Instance.FindView((BaseObject)spellTarget.Target); if (gameObject != null && !list.Contains(gameObject)) { list.Add(gameObject); } } if (spellTarget.Target is Party) { break; } } if (list.Count == 0) { Debug.LogError("PlayerSpellView: OnCharacterCastSpell: No views found! " + spellEventArgs); OnFXCancel(p_sender, p_args); return; } Vector3 p_slotOriginPosition; Vector3 p_slotForward; Vector3 p_slotLeft; Vector3 p_slotTargetPosition; if (spellEventArgs.SpellTargets[0].Target is Monster) { ViewManager.GetSlotDatas(party.Position, ((Monster)spellEventArgs.SpellTargets[0].Target).Position, out p_slotOriginPosition, out p_slotForward, out p_slotLeft, out p_slotTargetPosition); } else { Position position = party.Position + party.Direction; if (LegacyLogic.Instance.MapLoader.Grid.GetSlot(position) != null) { ViewManager.GetSlotDatas(party.Position, position, out p_slotOriginPosition, out p_slotForward, out p_slotLeft, out p_slotTargetPosition); } else { ViewManager.GetSlotDatas(party.Position, party.Position, out p_slotOriginPosition, out p_slotForward, out p_slotLeft, out p_slotTargetPosition); } } GameObject memberGameObject = m_PartyView.GetMemberGameObject(character.Index); ETargetType targetType = spellEventArgs.Spell.TargetType; if ((targetType & ETargetType.LINE_OF_SIGHT) == ETargetType.LINE_OF_SIGHT) { MovingEntity movingEntity = (MovingEntity)spellEventArgs.SpellTargets[0].Target; GameObject slotOrigin = ViewManager.Instance.GetSlotOrigin(movingEntity.Position); FXArgs args = new FXArgs(memberGameObject, slotOrigin, memberGameObject, slotOrigin, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list); FXQueue fxqueue2 = Helper.Instantiate <FXQueue>(fxqueue); fxqueue2.Finished += delegate(Object sender, EventArgs e) { OnFXQueueFinish(p_sender, p_args); }; fxqueue2.Execute(args); } else if ((targetType & ETargetType.MULTY) == ETargetType.MULTY) { GameObject slotOrigin2; if (spellEventArgs.SpellTargets[0].Target is MovingEntity) { MovingEntity movingEntity2 = (MovingEntity)spellEventArgs.SpellTargets[0].Target; slotOrigin2 = ViewManager.Instance.GetSlotOrigin(movingEntity2.Position); } else { slotOrigin2 = ViewManager.Instance.GetSlotOrigin(party.Position); } FXArgs args2 = new FXArgs(memberGameObject, slotOrigin2, memberGameObject, slotOrigin2, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list); FXQueue fxqueue3 = Helper.Instantiate <FXQueue>(fxqueue); fxqueue3.Finished += delegate(Object sender, EventArgs e) { OnFXQueueFinish(p_sender, p_args); }; fxqueue3.Execute(args2); } else if ((targetType & ETargetType.SINGLE) == ETargetType.SINGLE) { Boolean flag = true; foreach (GameObject gameObject2 in list) { GameObject p_endPoint = gameObject2; FXTags component = gameObject2.GetComponent <FXTags>(); if (component != null) { p_endPoint = component.FindOne("HitSpot"); } else { Debug.LogError("FXTags not found!!\nTarget=" + component, component); } FXArgs args3 = new FXArgs(memberGameObject, gameObject2, memberGameObject, p_endPoint, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list); FXQueue fxqueue4 = Helper.Instantiate <FXQueue>(fxqueue); if (flag) { flag = false; fxqueue4.Finished += delegate(Object sender, EventArgs e) { OnFXQueueFinish(p_sender, p_args); }; } fxqueue4.Execute(args3); } } else if ((targetType & ETargetType.ADJACENT) == ETargetType.ADJACENT) { GameObject slotOrigin3 = ViewManager.Instance.GetSlotOrigin(party.Position); FXArgs args4 = new FXArgs(memberGameObject, slotOrigin3, memberGameObject, slotOrigin3, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list); FXQueue fxqueue5 = Helper.Instantiate <FXQueue>(fxqueue); fxqueue5.Finished += delegate(Object sender, EventArgs e) { OnFXQueueFinish(p_sender, p_args); }; fxqueue5.Execute(args4); } else { Debug.Log("error !! spellType: " + targetType); FXArgs args5 = new FXArgs(memberGameObject, memberGameObject, memberGameObject, memberGameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list); FXQueue fxqueue6 = Helper.Instantiate <FXQueue>(fxqueue); fxqueue6.Finished += delegate(Object sender, EventArgs e) { OnFXQueueFinish(p_sender, p_args); }; fxqueue6.Execute(args5); } }