void IModule.OnCreate(object createParam) { // 检测依赖模块 if (MotionEngine.Contains(typeof(ResourceManager)) == false) { throw new Exception($"{nameof(GameObjectPoolManager)} depends on {nameof(ResourceManager)}"); } CreateParameters parameters = createParam as CreateParameters; if (createParam == null) { throw new Exception($"{nameof(GameObjectPoolManager)} create param is invalid."); } if (parameters.DefaultMaxCapacity < parameters.DefaultInitCapacity) { throw new Exception("The max capacity value must be greater the init capacity value."); } _enableLazyPool = parameters.EnableLazyPool; _defaultInitCapacity = parameters.DefaultInitCapacity; _defaultMaxCapacity = parameters.DefaultMaxCapacity; _defaultDestroyTime = parameters.DefaultDestroyTime; _root = new GameObject("[PoolManager]"); _root.transform.position = Vector3.zero; _root.transform.eulerAngles = Vector3.zero; UnityEngine.Object.DontDestroyOnLoad(_root); }
public static void SetRead(this MotionEngine Engine, bool State) { var setRead = new SetRead(State); var Payload = setRead.EncodePayload(); Engine.BeginSendData(Payload); }
/// <summary> /// Vibrates the device /// </summary> /// <param name="Engine">MotionEngine</param> /// <param name="Intensity">The strength of the vibration</param> public static void Vibrate(this MotionEngine Engine, int Intensity) { var vibrate = new Vibrate(Intensity); var Payload = vibrate.EncodePayload(); Engine.BeginSendData(Payload); }
private void CreateGameModules() { // 创建事件管理器 MotionEngine.CreateModule <EventManager>(); // 创建网络管理器 var networkCreateParam = new NetworkManager.CreateParameters(); networkCreateParam.PackageCoderType = typeof(ProtoPackageCoder); MotionEngine.CreateModule <NetworkManager>(networkCreateParam); // 创建资源管理器 var resourceCreateParam = new ResourceManager.CreateParameters(); resourceCreateParam.LocationRoot = GameDefine.AssetRootPath; resourceCreateParam.SimulationOnEditor = SimulationOnEditor; resourceCreateParam.BundleServices = new LocalBundleServices(); resourceCreateParam.DecryptServices = null; resourceCreateParam.AutoReleaseInterval = 10f; MotionEngine.CreateModule <ResourceManager>(resourceCreateParam); // 创建音频管理器 MotionEngine.CreateModule <AudioManager>(); // 创建场景管理器 MotionEngine.CreateModule <SceneManager>(); // 创建对象池管理器 MotionEngine.CreateModule <GameObjectPoolManager>(); // 直接进入游戏 MotionEngine.CreateModule <LuaManager>(); }
void IFsmNode.OnEnter() { AudioPlayerSetting.InitAudioSetting(); // 使用协程初始化 MotionEngine.StartCoroutine(Init()); }
void IConsoleWindow.OnGUI() { // 如果游戏模块没有创建 if (MotionEngine.Contains(typeof(GameObjectPoolManager)) == false) { _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, 30); ConsoleGUI.YellowLable($"{nameof(GameObjectPoolManager)} is not create."); ConsoleGUI.EndScrollView(); return; } var pools = GameObjectPoolManager.Instance.GetAllCollectors; ConsoleGUI.Lable($"池总数:{pools.Count}"); _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, 30); foreach (var pair in pools) { string content = $"[{pair.Value.Location}] CacheCount = {pair.Value.Count} SpwanCount = {pair.Value.SpawnCount}"; if (pair.Value.States == EAssetStates.Fail) { ConsoleGUI.RedLable(content); } else { ConsoleGUI.Lable(content); } } ConsoleGUI.EndScrollView(); }
public void Start() { HotfixNetManager.Instance.Create(); FsmManager.Instance.Create(); // 缓存所有的特性 HotfixLog.Log("收集所有热更类的属性并缓存"); { Attribute attribute1 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UILogin)); ILRManager.Instance.CacheHotfixAttribute(typeof(UILogin), attribute1); Attribute attribute2 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UIMain)); ILRManager.Instance.CacheHotfixAttribute(typeof(UIMain), attribute2); Attribute attribute3 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UIMap)); ILRManager.Instance.CacheHotfixAttribute(typeof(UIMap), attribute3); } // 开启协程加载资源 MotionEngine.StartCoroutine(AsyncLoadAssets()); // 测试热更事件 HotfixEventManager.Instance.AddListener <HotfixEventDefine.ClickSkill1Event>(OnHandleEventMessage); HotfixEventManager.Instance.AddListener <HotfixEventDefine.ClickSkill2Event>(OnHandleEventMessage); HotfixEventManager.Instance.AddListener <HotfixEventDefine.ClickSkill3Event>(OnHandleEventMessage); HotfixEventManager.Instance.AddListener <HotfixEventDefine.ClickSkill4Event>(OnHandleEventMessage); HotfixEventManager.Instance.AddListener <HotfixEventDefine.ClickSkill5Event>(OnHandleEventMessage); }
void IModule.OnCreate(object createParam) { // 检测依赖模块 if (MotionEngine.Contains(typeof(ResourceManager)) == false) { throw new Exception($"{nameof(WindowManager)} depends on {nameof(ResourceManager)}"); } }
public PushableComponent(GameObject toMove) { this.toMove = toMove; engine = new MotionEngine(toMove); OnInteractionBegin += PushableComponent_OnInteractionBegin; OnInteractionFinished += PushableComponent_OnInteractionFinished; }
public virtual void Update(int millisecondsSinceLastUpdate) { if (MotionEngine != null) { MotionEngine.Update(millisecondsSinceLastUpdate); WorldPosition += MotionEngine.Delta; } }
void IModule.OnCreate(System.Object param) { // 检测依赖模块 if (MotionEngine.Contains(typeof(ResourceManager)) == false) { throw new Exception($"{nameof(ConfigManager)} depends on {nameof(ResourceManager)}"); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); MotionEngine.Update(gameTime); Collider.Update(gameTime); ClosestInteractable = world.GetNearestInteractable(this, new Padding(10, 5)); }
/// <summary> /// 创建游戏模块 /// </summary> private IEnumerator CreateGameModules() { // 创建事件管理器 MotionEngine.CreateModule <EventManager>(); // 创建补间管理器 MotionEngine.CreateModule <TweenManager>(); // 创建网络管理器 var networkCreateParam = new NetworkManager.CreateParameters(); networkCreateParam.PackageCoderType = typeof(ProtoPackageCoder); networkCreateParam.PackageMaxSize = ushort.MaxValue; MotionEngine.CreateModule <NetworkManager>(networkCreateParam); // 创建补丁管理器 PatchManager.OfflinePlayModeParameters patchCreateParam = new PatchManager.OfflinePlayModeParameters(); patchCreateParam.SimulationOnEditor = SimulationOnEditor; MotionEngine.CreateModule <PatchManager>(patchCreateParam); var operation = PatchManager.Instance.InitializeAsync(); yield return(operation); // 创建资源管理器 var resourceCreateParam = new ResourceManager.CreateParameters(); resourceCreateParam.LocationRoot = GameDefine.AssetRootPath; resourceCreateParam.SimulationOnEditor = SimulationOnEditor; resourceCreateParam.BundleServices = PatchManager.Instance.BundleServices; resourceCreateParam.DecryptServices = null; resourceCreateParam.AutoReleaseInterval = 10f; MotionEngine.CreateModule <ResourceManager>(resourceCreateParam); // 创建配表管理器 MotionEngine.CreateModule <ConfigManager>(); // 创建音频管理器 MotionEngine.CreateModule <AudioManager>(); // 创建场景管理器 MotionEngine.CreateModule <SceneManager>(); // 创建窗口管理器 MotionEngine.CreateModule <WindowManager>(); // 创建ILR管理器 ILRManager.CreateParameters createParameters = new ILRManager.CreateParameters(); createParameters.IsEnableILRuntime = EnableILRuntime; createParameters.SimulationOnEditor = SimulationOnEditor; MotionEngine.CreateModule <ILRManager>(createParameters); // 反射服务服务接口 ConfigManager.Instance.ActivatorServices = ILRManager.Instance; WindowManager.Instance.ActivatorServices = ILRManager.Instance; // 开始游戏 ILRManager.Instance.StartGame(); }
public EnemyCharacterController() : base() { _statusEventDispatcher = new StatusEventDispatcher(); _displayController = new DisplayController(); _motionEngine = new MotionEngine(); _healthManager = new HealthManager(_statusEventDispatcher, _displayController); _autoActionController = new AutoActionController(_motionEngine, _displayController, _statusEventDispatcher); _threatReactionManager = new ThreatReactionManager(_autoActionController); }
void Awake() { // 初始化框架 bool showConsole = Application.isEditor || Debug.isDebugBuild; MotionEngine.Initialize(this, showConsole, HandleMotionFrameworkLog); // 初始化应用 InitAppliaction(); }
public FieldMovementController(MotionEngine motionEngine, DisplayController displayController, StatusEventDispatcher statusEventDispatcher) { _motionEngine = motionEngine; _displayController = displayController; _statusEventDispatcher = statusEventDispatcher; _isActive = false; _movementFrozen = false; _isMoving = false; _autoActionBlocking = false; _movementBlockDuration = 0.0f; }
public override void Update(GameTime gameTime) { base.Update(gameTime); MotionEngine.Update(gameTime); Collider.Update(gameTime); if (BehaviourObserver.HasScript) { BehaviourObserver.Script.Update(gameTime); } }
// Use this for initialization void Start() { UnitySystemConsoleRedirector.Redirect(); ddOptions = new List <Dropdown.OptionData>(); mDevices = new List <MotionDevice>(); engine = new MotionEngine(); btnScan.GetComponent <Button>().onClick.AddListener(btnScan_Click); btnConnect.GetComponent <Button>().onClick.AddListener(btnConnect_Click); btnVib.GetComponent <Button>().onClick.AddListener(btnVib_Click); btnStartRead.GetComponent <Button>().onClick.AddListener(btnStartRead_Click); btnStopRead.GetComponent <Button>().onClick.AddListener(btnStopRead_Click); }
void Awake() { #if !UNITY_EDITOR SimulationOnEditor = false; #endif // 初始化应用 InitAppliaction(); // 初始化框架 bool showConsole = Application.isEditor || Debug.isDebugBuild; MotionEngine.Initialize(this, showConsole, HandleMotionFrameworkLog); }
public PlayerCharacterController() : base() { _isActive = false; _blockAction = false; _statusEventDispatcher = new StatusEventDispatcher(); _motionEngine = new MotionEngine(); _displayController = new DisplayController(); _healthManager = new HealthManager(_statusEventDispatcher, _displayController); _selectionHandler = new SelectionHandler(_statusEventDispatcher); _fieldMovementController = new FieldMovementController(_motionEngine, _displayController, _statusEventDispatcher); _autoActionController = new AutoActionController(_motionEngine, _displayController, _statusEventDispatcher); _stageMotionEngine = new StageMotionEngine(_displayController); }
void Awake() { // 初始化应用 InitAppliaction(); // 初始化控制台 if (Application.isEditor || Debug.isDebugBuild) { DeveloperConsole.Initialize(); } // 初始化框架 MotionEngine.Initialize(this, HandleMotionFrameworkLog); }
public virtual void Update(int millisecondsSinceLastUpdate) { if (MotionEngine != null) { MotionEngine.Update(millisecondsSinceLastUpdate); } if (MotionEngine != null) { WorldPosition += MotionEngine.Delta; } if (Active) { CheckForAndHandleInput(millisecondsSinceLastUpdate); } }
void IModule.OnCreate(System.Object param) { // 检测依赖模块 if (MotionEngine.Contains(typeof(ResourceManager)) == false) { throw new Exception($"{nameof(AudioManager)} depends on {nameof(ResourceManager)}"); } _root = new GameObject("[AudioManager]"); UnityEngine.Object.DontDestroyOnLoad(_root); foreach (int value in System.Enum.GetValues(typeof(EAudioLayer))) { EAudioLayer layer = (EAudioLayer)value; _audioSourceWrappers.Add(layer, new AudioSourceWrapper(layer.ToString(), _root.transform)); } }
void Awake() { #if !UNITY_EDITOR SimulationOnEditor = false; #endif // 初始化应用 InitAppliaction(); // 初始化控制台 if (Application.isEditor || Debug.isDebugBuild) { DeveloperConsole.Initialize(); } // 初始化框架 MotionEngine.Initialize(this, HandleMotionFrameworkLog); }
/// <summary> /// 创建游戏模块 /// </summary> private IEnumerator CreateGameModules() { // 创建事件管理器 MotionEngine.CreateModule <EventManager>(); // 创建网络管理器 var networkCreateParam = new NetworkManager.CreateParameters(); networkCreateParam.PackageCoderType = typeof(ProtoPackageCoder); networkCreateParam.PackageMaxSize = ushort.MaxValue; MotionEngine.CreateModule <NetworkManager>(networkCreateParam); // 本地资源服务接口 LocalBundleServices bundleServices = new LocalBundleServices(); yield return(bundleServices.InitializeAsync(SimulationOnEditor)); // 创建资源管理器 var resourceCreateParam = new ResourceManager.CreateParameters(); resourceCreateParam.LocationRoot = GameDefine.AssetRootPath; resourceCreateParam.SimulationOnEditor = SimulationOnEditor; resourceCreateParam.BundleServices = bundleServices; resourceCreateParam.DecryptServices = null; resourceCreateParam.AutoReleaseInterval = 10f; MotionEngine.CreateModule <ResourceManager>(resourceCreateParam); // 创建音频管理器 MotionEngine.CreateModule <AudioManager>(); // 创建场景管理器 MotionEngine.CreateModule <SceneManager>(); // 创建对象池管理器 MotionEngine.CreateModule <GameObjectPoolManager>(); // 创建ILR管理器 ILRManager.CreateParameters createParameters = new ILRManager.CreateParameters(); createParameters.IsEnableILRuntime = EnableILRuntime; MotionEngine.CreateModule <ILRManager>(createParameters); // 开始游戏 ILRManager.Instance.StartGame(); }
public virtual void Update(int millisecondsSinceLastUpdate) { if ((!Paused) && (MotionEngine != null)) { MotionEngine.Update(millisecondsSinceLastUpdate); WorldPosition += MotionEngine.Delta; if (_lifeCycleState == LifeCycleStateValue.Exiting) { Tint = Color.Lerp(Color.White, Color.Transparent, _motionEngine.Progress); Scale = 1.0f + (_motionEngine.Progress / 2.0f); if (_motionEngine.Progress == 1.0f) { UpdateLifeCycleState(LifeCycleStateValue.ReadyForRemoval); } } } }
public void Update(int millisecondsSinceLastUpdate) { if (ReturningToPreviousLocation) { _motionEngine.Target = _startPosition; MotionEngine.Update(millisecondsSinceLastUpdate); if ((WorldPosition == _startPosition) || (Vector2.DistanceSquared(WorldPosition, _startPosition) < MotionEngine.Delta.LengthSquared())) { WorldPosition = _startPosition; ReturningToPreviousLocation = false; } else { WorldPosition += MotionEngine.Delta; } } }
public void Start() { HotfixNetManager.Instance.Create(); FsmManager.Instance.Create(); // 缓存所有的特性 HotfixLog.Log("收集所有热更类的属性并缓存"); { Attribute attribute1 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UILogin)); ILRManager.Instance.CacheHotfixAttribute(typeof(UILogin), attribute1); Attribute attribute2 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UIMain)); ILRManager.Instance.CacheHotfixAttribute(typeof(UIMain), attribute2); Attribute attribute3 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UIMap)); ILRManager.Instance.CacheHotfixAttribute(typeof(UIMap), attribute3); } // 开启协程加载资源 MotionEngine.StartCoroutine(AsyncLoadAssets()); }
/// <summary> /// 创建游戏模块 /// </summary> private IEnumerator CreateGameModules() { // 创建事件管理器 MotionEngine.CreateModule <EventManager>(); // 创建补间管理器 MotionEngine.CreateModule <TweenManager>(); // 本地资源服务接口 LocalBundleServices bundleServices = new LocalBundleServices(); yield return(bundleServices.InitializeAsync(SimulationOnEditor)); // 创建资源管理器 var resourceCreateParam = new ResourceManager.CreateParameters(); resourceCreateParam.LocationRoot = GameDefine.AssetRootPath; resourceCreateParam.SimulationOnEditor = SimulationOnEditor; resourceCreateParam.BundleServices = bundleServices; resourceCreateParam.DecryptServices = null; resourceCreateParam.AutoReleaseInterval = 1f; MotionEngine.CreateModule <ResourceManager>(resourceCreateParam); // 创建音频管理器 MotionEngine.CreateModule <AudioManager>(); // 创建场景管理器 MotionEngine.CreateModule <SceneManager>(); // 创建对象池管理器 MotionEngine.CreateModule <GameObjectPoolManager>(); // 最后创建游戏业务逻辑模块 MotionEngine.CreateModule <DataManager>(); MotionEngine.CreateModule <WindowManager>(); MotionEngine.CreateModule <FsmManager>(); // 开始游戏逻辑 FsmManager.Instance.StartGame(); }
private IEnumerator CreateGameModules() { // 创建事件管理器 MotionEngine.CreateModule <EventManager>(); // 创建网络管理器 var networkCreateParam = new NetworkManager.CreateParameters(); networkCreateParam.PackageCoderType = typeof(ProtoPackageCoder); MotionEngine.CreateModule <NetworkManager>(networkCreateParam); // 创建补丁管理器 var patchCreateParam = new PatchManager.OfflinePlayModeParameters(); patchCreateParam.SimulationOnEditor = SimulationOnEditor; MotionEngine.CreateModule <PatchManager>(patchCreateParam); var operation = PatchManager.Instance.InitializeAsync(); yield return(operation); // 创建资源管理器 var resourceCreateParam = new ResourceManager.CreateParameters(); resourceCreateParam.LocationRoot = GameDefine.AssetRootPath; resourceCreateParam.SimulationOnEditor = SimulationOnEditor; resourceCreateParam.BundleServices = PatchManager.Instance.BundleServices; resourceCreateParam.DecryptServices = null; resourceCreateParam.AutoReleaseInterval = 10f; MotionEngine.CreateModule <ResourceManager>(resourceCreateParam); // 创建音频管理器 MotionEngine.CreateModule <AudioManager>(); // 创建场景管理器 MotionEngine.CreateModule <SceneManager>(); // 直接进入游戏 MotionEngine.CreateModule <LuaManager>(); LuaManager.Instance.StartGame(); }