gmhevinci / MotionFramework

MotionFramework is unity3d game framework.
MIT License
621 stars 116 forks source link

StartCoroutine使用字符串方法名时,才能用StopCoroutine停用(StopCoroutine也必须使用字符串方法名)。 #16

Closed 1005399541 closed 2 years ago

1005399541 commented 2 years ago

region 协程相关

    /// <summary>
    /// 开启一个协程
    /// </summary>
    public static Coroutine StartCoroutine(IEnumerator coroutine)
    {
        if (_behaviour == null)
            throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize");
        return _behaviour.StartCoroutine(coroutine);
    }

    /// <summary>
    /// 停止一个协程
    /// </summary>
    /// <param name="coroutine"></param>
    public static void StopCoroutine(Coroutine coroutine)
    {
        if (_behaviour == null)
            throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize");
        _behaviour.StopCoroutine(coroutine);
    }

需要把这两个方法改成 : 字符串的协程重载方法

gmhevinci commented 2 years ago

增加了字符串为参数的协程启动和停止方法