Ejemplo n.º 1
0
 private void OnBeginEffect(UnityEventArgs <FXArgs> e)
 {
     if (e != null && e.EventArgs != null && e.EventArgs.Origin != null)
     {
         MeshRenderer[] componentsInChildren = e.EventArgs.Origin.GetComponentsInChildren <MeshRenderer>(true);
         m_render = null;
         for (Int32 i = 0; i < componentsInChildren.Length; i++)
         {
             foreach (String value in PROJECTILE_OBJECT_POSSIBLE_NAMES)
             {
                 if (componentsInChildren[i].name.Contains(value))
                 {
                     m_render = componentsInChildren[i];
                     i        = componentsInChildren.Length;
                     break;
                 }
             }
         }
         if (m_render != null)
         {
             m_wasEnabledAtFirst = m_render.enabled;
             GameObject gameObject  = m_render.gameObject;
             GameObject gameObject2 = Helper.Instantiate <GameObject>(gameObject);
             gameObject2.transform.parent     = this.transform;
             gameObject2.transform.position   = gameObject.transform.position;
             gameObject2.transform.rotation   = gameObject.transform.rotation;
             gameObject2.transform.localScale = gameObject.transform.lossyScale;
             m_Projectile = gameObject2.transform;
             Transform[] array = new Transform[this.transform.childCount];
             for (Int32 k = 0; k < array.Length; k++)
             {
                 array[k] = transform.GetChild(k);
             }
             foreach (Transform transform in array)
             {
                 if (transform != gameObject2.transform)
                 {
                     transform.transform.localPosition = gameObject2.transform.localRotation * transform.transform.localPosition + gameObject2.transform.localPosition;
                     transform.parent = gameObject2.transform;
                 }
             }
             m_EffectStartTime            = Time.time;
             gameObject2.renderer.enabled = true;
             m_render.enabled             = false;
         }
         else
         {
             Debug.LogError("ProjectileDublicator: boomerang not found! " + e.EventArgs.Origin.name);
         }
     }
     else
     {
         Debug.LogError("ProjectileDublicator: event args are NULL!");
     }
 }
Ejemplo n.º 2
0
 public static void SendEvent(this Component comp, String methodName, UnityEventArgs handler, SendMessageOptions options)
 {
     if (comp == null)
     {
         throw new ArgumentNullException("comp");
     }
     if (String.IsNullOrEmpty(methodName))
     {
         throw new ArgumentNullException("methodName");
     }
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     comp.SendMessage(methodName, handler, options);
 }
Ejemplo n.º 3
0
 public static void SendEvent(this GameObject go, String methodName, UnityEventArgs handler, SendMessageOptions options)
 {
     if (go == null)
     {
         throw new ArgumentNullException("go");
     }
     if (String.IsNullOrEmpty(methodName))
     {
         throw new ArgumentNullException("methodName");
     }
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     go.SendMessage(methodName, handler, options);
 }
Ejemplo n.º 4
0
 public static void SendEvent(this Component comp, String methodName, UnityEventArgs handler)
 {
     comp.SendEvent(methodName, handler, SendMessageOptions.DontRequireReceiver);
 }
Ejemplo n.º 5
0
 public static void SendEvent(this MonoBehaviour comp, String methodName, UnityEventArgs handler, SendMessageOptions options)
 {
     SendEvent((Component)comp, methodName, handler, options);
 }
Ejemplo n.º 6
0
 public static void SendEvent(this GameObject go, String methodName, UnityEventArgs handler)
 {
     go.SendEvent(methodName, handler, SendMessageOptions.DontRequireReceiver);
 }