예제 #1
0
        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,
            });
        }
예제 #2
0
        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");
                }
            }
        }