Skip to content

Commit

Permalink
ModuleScript: Added OnAwake
Browse files Browse the repository at this point in the history
  • Loading branch information
Emik03 committed Jul 25, 2021
1 parent d464206 commit 5bf1c09
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Documentation/KeepCoding_ModuleScript.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Implements [IDump](KeepCoding_IDump.md 'KeepCoding.IDump'), [ILog](KeepCoding_IL
| [Log&lt;T&gt;(T, object[])](KeepCoding_ModuleScript_Log_T_(T_object__).md 'KeepCoding.ModuleScript.Log&lt;T&gt;(T, object[])') | Logs multiple entries, but formats it to be compliant with the Logfile Analyzer.<br/> |
| [LogMultiple(string[])](KeepCoding_ModuleScript_LogMultiple(string__).md 'KeepCoding.ModuleScript.LogMultiple(string[])') | Logs multiple entries to the console.<br/> |
| [OnActivate()](KeepCoding_ModuleScript_OnActivate().md 'KeepCoding.ModuleScript.OnActivate()') | Called when the lights turn on.<br/> |
| [OnAwake()](KeepCoding_ModuleScript_OnAwake().md 'KeepCoding.ModuleScript.OnAwake()') | Called when the module instantiates, well before the lights turn on.<br/> |
| [OnColorblindChanged(bool)](KeepCoding_ModuleScript_OnColorblindChanged(bool).md 'KeepCoding.ModuleScript.OnColorblindChanged(bool)') | Called when colorblind support needs to be updated for the module. Do not call `base.OnColorblindChanged()`.<br/> |
| [OnModuleStrike(string)](KeepCoding_ModuleScript_OnModuleStrike(string).md 'KeepCoding.ModuleScript.OnModuleStrike(string)') | Called when any module on the current bomb has issued a strike.<br/> |
| [OnNeedySolved(string)](KeepCoding_ModuleScript_OnNeedySolved(string).md 'KeepCoding.ModuleScript.OnNeedySolved(string)') | Called when any [KMNeedyModule](https://docs.microsoft.com/en-us/dotnet/api/KMNeedyModule 'KMNeedyModule') on the current bomb has been solved.<br/> |
Expand Down
7 changes: 7 additions & 0 deletions Documentation/KeepCoding_ModuleScript_OnAwake().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#### [KeepCoding](index.md 'index')
### [KeepCoding](KeepCoding.md 'KeepCoding').[ModuleScript](KeepCoding_ModuleScript.md 'KeepCoding.ModuleScript')
## ModuleScript.OnAwake() Method
Called when the module instantiates, well before the lights turn on.
```csharp
public virtual void OnAwake();
```
7 changes: 7 additions & 0 deletions Source/MonoBehaviours/ModuleScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ public void Strike(params string[] logs)
Module.Strike();
}

/// <summary>
/// Called when the module instantiates, well before the lights turn on.
/// </summary>
public virtual void OnAwake() { }

/// <summary>
/// Called when the lights turn on.
/// </summary>
Expand Down Expand Up @@ -409,6 +414,8 @@ protected void Awake()

StartCoroutine(CheckForUpdates());
StartCoroutine(WaitForBomb());

OnAwake();
}

private void HookModules()
Expand Down

0 comments on commit 5bf1c09

Please sign in to comment.