# MomoEngineCoreDemo
**Repository Path**: CCUserTop/momo-engine-core-demo
## Basic Information
- **Project Name**: MomoEngineCoreDemo
- **Description**: Behavior脚本(继承自Behavior类),脚本生命周期,协程,等等 支持:控制台,WPF, WinForm, MAUI(等待正式版)
- **Primary Language**: C#
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2022-12-22
- **Last Updated**: 2022-12-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# MomoEngine.Core
- MomoEngine.Core是一款轻量级的,集合C#脚本系统,协程等等于一体的框架系统,不依赖于任何平台,开箱即用
- MomoEngine支持的平台:控制台应用,Winfom应用,Wpf应用,Maui(等正式版)
- 使用方类似于Unity脚本系统,就是无GUI编辑器
- 所有脚本都继承自Behavior
- 协程是可以在多线程中启动的
- 立个Flag:并行协程
#### 脚本挂载/移除 函数
```C#
namespace EngineFramework.Application;
public class Engine
{
#region 添加Behaviour脚本
///
/// 添加一个程序集下所有Behaviour脚本 注意:只能添加 公共无惨构造类 的Behaviour脚本
///
/// 程序集
/// Errors
public string[] AddBehaviour(Assembly assembly)
///
/// 添加多个程序集下所有Behaviour脚本 注意:只能添加 公共无惨构造类 的Behaviour脚本
///
/// 程序集
/// Errors
public string[] AddBehaviour(Assembly[] assemblys)
///
/// 添加Behaviour脚本
///
/// 类型
/// 参数
///
public (bool State, string Error) AddBehaviour(Type type, params object[] args)
///
/// 添加Behaviour脚本
///
/// 参数
///
public (bool State, string Error) AddBehaviour(params object[] args) where T : Behaviour
#endregion
#region 移除Behaviour脚本
///
/// 移除Behaviour脚本
///
/// 参数
///
public void RemoveBehaviour() where T : Behaviour
///
/// 移除Behaviour脚本
///
/// 类型
///
public void RemoveBehaviour(Type type)
///
/// 移除Behaviour脚本
///
/// 类型名称
///
public void RemoveBehaviour(string typeName)
#endregion
}
```
#### 协程启停函数 函数
```C#
namespace EngineFramework.Application;
public class Behaviour : BehaviourBase
{
#region 启动协程
///
/// 启动协程
///
/// 函数名称
/// 协程
public Coroutine StartCoroutine(string methodName)
///
/// 启动协程
///
/// 函数名称
/// 参数
/// 协程
public Coroutine StartCoroutine(string methodName, params object[] arg)
///
/// 启动协程
///
/// 迭代器
/// 协程
public Coroutine StartCoroutine(IEnumerator routine)
#endregion
#region 协程是否运行中
///
/// 协程是否运行中
///
/// 协程
///
public bool CoroutineIsRunning(Coroutine routine)
///
/// 协程是否运行中
///
/// 迭代器
///
public bool CoroutineIsRunning(IEnumerator routine)
///
/// 协程是否运行中
///
/// 函数名称
///
public bool CoroutineIsRunning(string methodName)
#endregion
#region 停止协程
///
/// 停止协程
///
/// 函数名称
public void StopCoroutine(string methodName)
///
/// 停止协程
///
/// 迭代器
public void StopCoroutine(IEnumerator routine)
///
/// 停止协程
///
/// 协程
public void StopCoroutine(Coroutine routine)
///
/// 停止所有协程
///
public void StopAllCoroutines()
#endregion
}
```