-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #295 from crashkonijn/feature/better-action-disabler
Feature: Actions can now be (temporarily) disabled per action instead of action type
- Loading branch information
Showing
21 changed files
with
157 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=_002E_002E_005Cpackage_005Cruntime_005Ccrashkonijn_002Eagent_002Eruntime_005Cdisablers/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=_002E_002E_005Cpackage_005Cruntime_005Ccrashkonijn_002Eagent_002Eruntime_005Creferences/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
Package/Runtime/CrashKonijn.Agent.Core/Interfaces/IActionDisabler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace CrashKonijn.Agent.Core | ||
{ | ||
public interface IActionDisabler | ||
{ | ||
bool IsDisabled(IAgent agent); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Package/Runtime/CrashKonijn.Agent.Core/Interfaces/IActionDisabler.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
Package/Runtime/CrashKonijn.Agent.Runtime/Disablers/ActionDisabler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using CrashKonijn.Agent.Core; | ||
|
||
namespace CrashKonijn.Agent.Runtime | ||
{ | ||
public static class ActionDisabler | ||
{ | ||
public static IActionDisabler Forever => new ForeverActionDisabler(); | ||
public static IActionDisabler ForTime(float time) => new ForTimeActionDisabler(time); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Package/Runtime/CrashKonijn.Agent.Runtime/Disablers/ActionDisabler.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
Package/Runtime/CrashKonijn.Agent.Runtime/Disablers/ForTimeActionDisabler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using CrashKonijn.Agent.Core; | ||
using UnityEngine; | ||
|
||
namespace CrashKonijn.Agent.Runtime | ||
{ | ||
public class ForTimeActionDisabler : IActionDisabler | ||
{ | ||
private readonly float enableAt; | ||
|
||
public ForTimeActionDisabler(float time) | ||
{ | ||
this.enableAt = Time.time + time; | ||
} | ||
|
||
public bool IsDisabled(IAgent agent) | ||
{ | ||
return Time.time < this.enableAt; | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Package/Runtime/CrashKonijn.Agent.Runtime/Disablers/ForTimeActionDisabler.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
Package/Runtime/CrashKonijn.Agent.Runtime/Disablers/ForeverActionDisabler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using CrashKonijn.Agent.Core; | ||
|
||
namespace CrashKonijn.Agent.Runtime | ||
{ | ||
public class ForeverActionDisabler : IActionDisabler | ||
{ | ||
public bool IsDisabled(IAgent agent) => true; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Package/Runtime/CrashKonijn.Agent.Runtime/Disablers/ForeverActionDisabler.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters