From 9d64fd2786af13b526f7e27dd7352789e8f32e83 Mon Sep 17 00:00:00 2001 From: ShaneRH Date: Wed, 1 Jun 2022 08:22:11 +0200 Subject: [PATCH 1/2] Proposed change to allow for deltaTIme --- .../Scripts/Modules/MoverModule.cs | 2 +- .../Scripts/Modules/SpawnerModule.cs | 2 +- Packages/RH.ModulePattern/Runtime/IModule.cs | 32 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/MoverModule.cs b/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/MoverModule.cs index 4c99201..e20dcec 100644 --- a/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/MoverModule.cs +++ b/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/MoverModule.cs @@ -37,7 +37,7 @@ public void Stop() { _canMove = false; } - public void UpdateModule() + public void UpdateModule(float? delta) { if (!_canMove) { diff --git a/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/SpawnerModule.cs b/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/SpawnerModule.cs index 877590e..80b9cbd 100644 --- a/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/SpawnerModule.cs +++ b/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/SpawnerModule.cs @@ -75,7 +75,7 @@ public void Stop() _canSpawn = false; } - public void UpdateModule() + public void UpdateModule(float? delta) { if (!_canSpawn) { diff --git a/Packages/RH.ModulePattern/Runtime/IModule.cs b/Packages/RH.ModulePattern/Runtime/IModule.cs index b180ebc..814dac5 100644 --- a/Packages/RH.ModulePattern/Runtime/IModule.cs +++ b/Packages/RH.ModulePattern/Runtime/IModule.cs @@ -1,20 +1,20 @@ -//(C) RenderHeads PTY LTD 2021 -//Author: Ross Borchers +using System.Collections; +using System.Collections.Generic; namespace RenderHeads.Tooling.Core.ModulePattern { - /// - /// Base interface for all modules, IModuleFactory requires modules inherit from this. - /// General module usage pattern is: - /// RAII. All initialization is done through the constructor. After a constructor is run the module should be fully usable. - /// UpdateModules should be called at regular intervals. The order of module updates should be controlled by the caller to ensure all dependencies have already been updated. - /// Pass in dependencies through the constructor IOC like. - /// + /// + /// Base interface for all modules, IModuleFactory requires modules inherit from this. + /// General module usage pattern is: + /// RAII. All initialization is done through the constructor. After a constructor is run the module should be fully usable. + /// UpdateModules should be called at regular intervals. The order of module updates should be controlled by the caller to ensure all dependencies have already been updated. + /// Pass in dependencies through the constructor IOC like. + /// public interface IModule - { - /// - /// Should be called at a regular interval. The order of module updates should be controlled by the caller to ensure all dependencies have already been updated. - /// - void UpdateModule(); - } -} \ No newline at end of file + {/// + /// Should be called at a regular interval. The order of module updates should be controlled by the caller to ensure all dependencies have already been updated. + /// + /// Pass in a deltaTime calculated in parent update, if you want to pass that into underlying update event, so thay you don't need to query it within the method + void UpdateModule(float? delta = null); + } +} From 54325efa0efdab0a65101c8dbd3394ea03c79a50 Mon Sep 17 00:00:00 2001 From: ShaneRH Date: Wed, 1 Jun 2022 10:13:03 +0200 Subject: [PATCH 2/2] Clarified intent --- .../ModulePatternSample/Scripts/Modules/MoverModule.cs | 2 +- .../ModulePatternSample/Scripts/Modules/SpawnerModule.cs | 2 +- Packages/RH.ModulePattern/Runtime/IModule.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/MoverModule.cs b/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/MoverModule.cs index e20dcec..f451fd3 100644 --- a/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/MoverModule.cs +++ b/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/MoverModule.cs @@ -37,7 +37,7 @@ public void Stop() { _canMove = false; } - public void UpdateModule(float? delta) + public void UpdateModule(float? deltaTime) { if (!_canMove) { diff --git a/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/SpawnerModule.cs b/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/SpawnerModule.cs index 80b9cbd..3fdfebc 100644 --- a/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/SpawnerModule.cs +++ b/Assets/RenderHeads/ModulePatternSample/Scripts/Modules/SpawnerModule.cs @@ -75,7 +75,7 @@ public void Stop() _canSpawn = false; } - public void UpdateModule(float? delta) + public void UpdateModule(float? deltaTime) { if (!_canSpawn) { diff --git a/Packages/RH.ModulePattern/Runtime/IModule.cs b/Packages/RH.ModulePattern/Runtime/IModule.cs index 814dac5..e6ef8d1 100644 --- a/Packages/RH.ModulePattern/Runtime/IModule.cs +++ b/Packages/RH.ModulePattern/Runtime/IModule.cs @@ -15,6 +15,6 @@ public interface IModule /// Should be called at a regular interval. The order of module updates should be controlled by the caller to ensure all dependencies have already been updated. /// /// Pass in a deltaTime calculated in parent update, if you want to pass that into underlying update event, so thay you don't need to query it within the method - void UpdateModule(float? delta = null); + void UpdateModule(float? deltaTime = null); } }