public static GameObject OnMousePrimaryClick(this GameObject gameObject, PrimaryClickListener.Properties p) { // Add the component PrimaryClickListener.AddComponent(gameObject, p); // Return to fluent design return(gameObject); }
private void Start() { if (clickListener == null) { clickListener = GetComponent <PrimaryClickListener>(); if (clickListener == null) { if (clickListenerInTrigger == null) { clickListenerInTrigger = GetComponent <PrimaryClickInTriggerListener>(); if (clickListenerInTrigger == null) { throw new System.ArgumentNullException("FollowMouse2D: Cant find a valid click listener"); } else { l = clickListenerInTrigger; } } else { l = clickListenerInTrigger; } } else { l = clickListener; } } else { l = clickListener; } if (rb == null) { rb = GetComponent <Rigidbody2D>(); if (rb == null) { throw new System.NullReferenceException("FollowMouse2D: Cant find a valid rigidBody2D"); } } ft = Timer.AddComponent(gameObject, new Timer.Properties { allowUnexpectedEnd = true, duration = 1 / ((float)frecuency), loop = false, playOnAwake = true, timeMode = Timer.TimeMode.DeltaTime, }); }
private void Start() { if (clickListener == null) { clickListener = GetComponent <PrimaryClickListener>(); if (clickListener == null) { if (clickListenerInTrigger == null) { clickListenerInTrigger = GetComponent <PrimaryClickInTriggerListener>(); if (clickListenerInTrigger == null) { throw new System.ArgumentNullException("FollowMouse2D: Cant find a valid click listener"); } else { l = clickListenerInTrigger; } } else { l = clickListenerInTrigger; } } else { l = clickListener; } } else { l = clickListener; } if (rb == null) { rb = GetComponent <Rigidbody2D>(); if (rb == null) { throw new System.NullReferenceException("FollowMouse2D: Cant find a valid rigidBody2D"); } } }