Jelajahi Sumber

Rename Condition interface to ICondition

Jean-David Moisan 6 tahun lalu
induk
melakukan
7c78275eea

+ 1 - 1
Source/ConditionGamePad.cs

@@ -6,7 +6,7 @@ namespace Apos.Input {
     /// Checks various conditions on a specific gamepad button.
     /// Non static methods implicitly make sure that the game is active. Otherwise returns false.
     /// </summary>
-    public class ConditionGamePad : Condition {
+    public class ConditionGamePad : ICondition {
 
         // Group: Constructors
 

+ 1 - 1
Source/ConditionKeyboard.cs

@@ -5,7 +5,7 @@ namespace Apos.Input {
     /// Checks various conditions on a specific keyboard key.
     /// Non static methods implicitly make sure that the game is active. Otherwise returns false.
     /// </summary>
-    public class ConditionKeyboard : Condition {
+    public class ConditionKeyboard : ICondition {
 
         // Group: Constructors
 

+ 1 - 1
Source/ConditionMouse.cs

@@ -6,7 +6,7 @@ namespace Apos.Input {
     /// Checks various conditions on a specific mouse button.
     /// Non static methods implicitly make sure that the game is active. Otherwise returns false.
     /// </summary>
-    public class ConditionMouse : Condition {
+    public class ConditionMouse : ICondition {
 
         // Group: Constructors
 

+ 17 - 17
Source/ConditionSet.cs

@@ -15,15 +15,15 @@ namespace Apos.Input {
         /// Empty ConditionSet.
         /// </summary>
         public ConditionSet() {
-            _needCondition = new List<Condition>();
-            _notCondition = new List<Condition>();
+            _needCondition = new List<ICondition>();
+            _notCondition = new List<ICondition>();
         }
         /// <summary>
         /// ConditionSet with initial values.
         /// </summary>
         /// <param name="needCondition">A list of needed conditions.</param>
         /// <param name="notCondition">A list of condition that must never be pressed.</param>
-        public ConditionSet(List<Condition> needCondition, List<Condition> notCondition) {
+        public ConditionSet(List<ICondition> needCondition, List<ICondition> notCondition) {
             _needCondition = needCondition;
             _notCondition = notCondition;
         }
@@ -56,7 +56,7 @@ namespace Apos.Input {
         }
         /// <param name="condition">Adds a condition that is needed.</param>
         /// <returns>Returns itself for easy function chaining.</returns>
-        public ConditionSet AddNeed(Condition condition) {
+        public ConditionSet AddNeed(ICondition condition) {
             _needCondition.Add(condition);
             return this;
         }
@@ -86,7 +86,7 @@ namespace Apos.Input {
         }
         /// <param name="condition">Adds a condition that must not be pressed.</param>
         /// <returns>Returns itself for easy function chaining.</returns>
-        public ConditionSet AddNot(Condition condition) {
+        public ConditionSet AddNot(ICondition condition) {
             _notCondition.Add(condition);
             return this;
         }
@@ -99,19 +99,19 @@ namespace Apos.Input {
             bool held = true;
             bool notHeld = false;
 
-            foreach (Condition c in _needCondition) {
+            foreach (ICondition c in _needCondition) {
                 pressed = pressed || c.Pressed();
                 if (pressed) {
                     break;
                 }
             }
-            foreach (Condition c in _needCondition) {
+            foreach (ICondition c in _needCondition) {
                 held = held && c.Held();
                 if (!held) {
                     break;
                 }
             }
-            foreach (Condition c in _notCondition) {
+            foreach (ICondition c in _notCondition) {
                 notHeld = notHeld || c.Held();
                 if (notHeld) {
                     break;
@@ -128,13 +128,13 @@ namespace Apos.Input {
             bool held = true;
             bool notHeld = false;
 
-            foreach (Condition c in _needCondition) {
+            foreach (ICondition c in _needCondition) {
                 held = held && c.Held();
                 if (!held) {
                     break;
                 }
             }
-            foreach (Condition c in _notCondition) {
+            foreach (ICondition c in _notCondition) {
                 notHeld = notHeld || c.Held();
                 if (notHeld) {
                     break;
@@ -151,13 +151,13 @@ namespace Apos.Input {
             bool held = true;
             bool notHeld = false;
 
-            foreach (Condition c in _needCondition) {
+            foreach (ICondition c in _needCondition) {
                 held = held && c.HeldOnly();
                 if (!held) {
                     break;
                 }
             }
-            foreach (Condition c in _notCondition) {
+            foreach (ICondition c in _notCondition) {
                 notHeld = notHeld || c.Held();
                 if (notHeld) {
                     break;
@@ -175,19 +175,19 @@ namespace Apos.Input {
             bool held = true;
             bool notHeld = false;
 
-            foreach (Condition c in _needCondition) {
+            foreach (ICondition c in _needCondition) {
                 released = released || c.Released();
                 if (released) {
                     break;
                 }
             }
-            foreach (Condition c in _needCondition) {
+            foreach (ICondition c in _needCondition) {
                 held = held && (c.Held() || c.Released());
                 if (!held) {
                     break;
                 }
             }
-            foreach (Condition c in _notCondition) {
+            foreach (ICondition c in _notCondition) {
                 notHeld = notHeld || c.Held();
                 if (notHeld) {
                     break;
@@ -202,10 +202,10 @@ namespace Apos.Input {
         /// <summary>
         /// List of Condition that are needed.
         /// </summary>
-        private List<Condition> _needCondition;
+        private List<ICondition> _needCondition;
         /// <summary>
         /// List of Condition that must never be held.
         /// </summary>
-        private List<Condition> _notCondition;
+        private List<ICondition> _notCondition;
     }
 }

+ 1 - 1
Source/Condition.cs → Source/ICondition.cs

@@ -2,7 +2,7 @@ namespace Apos.Input {
     /// <summary>
     /// Interface for a Condition.
     /// </summary>
-    public interface Condition {
+    public interface ICondition {
         /// <returns>Returns true when a condition was false and is now true.</returns>
         bool Pressed();
         /// <returns>Returns true when a condition is now true.</returns>