Explorar o código

Fix AllCondition when empty

Jean-David Moisan %!s(int64=4) %!d(string=hai) anos
pai
achega
bc9a51b5f9
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      Source/AllCondition.cs

+ 2 - 2
Source/AllCondition.cs

@@ -41,7 +41,7 @@ namespace Apos.Input {
         /// Returns true when all the needed conditions are held.
         /// Returns true when all the needed conditions are held.
         /// </returns>
         /// </returns>
         public bool Held(bool canConsume = true) {
         public bool Held(bool canConsume = true) {
-            bool held = true;
+            bool held = _conditions.Length > 0;
 
 
             foreach (ICondition c in _conditions) {
             foreach (ICondition c in _conditions) {
                 held = held && c.Held(false);
                 held = held && c.Held(false);
@@ -59,7 +59,7 @@ namespace Apos.Input {
         /// Returns true when all the needed conditions were held and are now held.
         /// Returns true when all the needed conditions were held and are now held.
         /// </returns>
         /// </returns>
         public bool HeldOnly(bool canConsume = true) {
         public bool HeldOnly(bool canConsume = true) {
-            bool held = true;
+            bool held = _conditions.Length > 0;
 
 
             foreach (ICondition c in _conditions) {
             foreach (ICondition c in _conditions) {
                 held = held && c.HeldOnly(false);
                 held = held && c.HeldOnly(false);