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); 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); 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; } } }