Beispiel #1
0
 private void OnEnable()
 {
     InvokeAlternatives.Invoke(this, startDelay, () =>
     {
         moveCorout = StartCoroutine(Move_Routine());
     });
 }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        trigger = GetComponent <EventTrigger>();
        SubscribeEvent(SetScaleToPressed, EventTriggerType.PointerDown);
        SubscribeEvent(ResetScale, EventTriggerType.PointerUp);
        SubscribeEvent(() =>
        {
            InvokeAlternatives.Invoke(this, 0.15f, onClick.SafeInvoke);
        }, EventTriggerType.PointerClick);

        startScale = transform.localScale;
    }
Beispiel #3
0
    void SendMessage(Animator obj, string message, float delay)
    {
        if (corout != null)
        {
            Debug.Log("Routine aborted");
            return;
        }

        corout = InvokeAlternatives.Invoke(obj.GetComponent <MonoBehaviour>(), delay, () =>
        {
            obj.SendMessage(message);
            corout = null;
        });

        //Debug.Log("Exit called");
    }
Beispiel #4
0
    // OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
    //override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
    //override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    void SetAudioField(Animator obj, PlayAudioField field)
    {
        if (field.delay > 0f)
        {
            if (corout == null)
            {
                corout = InvokeAlternatives.Invoke(obj.GetComponent <MonoBehaviour>(), field.delay, () =>
                {
                    SoundManager.instance.PlaySingle(field.value);
                    corout = null;
                });
            }
        }
        else
        {
            SoundManager.instance.PlaySingle(field.value);
        }

        //Debug.Log("Exit called");
    }
    // OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
    //override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
    //override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    void SetFloatField(Animator obj, FloatAnimField field)
    {
        if (field.delay > 0f)
        {
            if (corout == null)
            {
                corout = InvokeAlternatives.Invoke(obj.GetComponent <MonoBehaviour>(), field.delay, () =>
                {
                    obj.SetFloat(field.name, field.value);
                    corout = null;
                });
            }
        }
        else
        {
            obj.SetFloat(field.name, field.value);
        }

        //Debug.Log("Exit called");
    }
 public static Coroutine InvokeRepeating(this MonoBehaviour starterScript, float startDelay, float repeatDelay, UnityAction action)
 {
     return(InvokeAlternatives.InvokeRepeating(starterScript, startDelay, repeatDelay, action));
 }
 public static Coroutine InvokeAfterFrame(this MonoBehaviour starterScript, UnityAction action)
 {
     return(InvokeAlternatives.InvokeAfterFrame(starterScript, action));
 }
Beispiel #8
0
 public void StoreObject(GameObject input, float delay)
 {
     InvokeAlternatives.Invoke(this, delay, () => { StoreObject(input); });
 }