private bool CompareText(ResourceText target, ResourceText op1, CompareOperation operation) { switch (operation) { case CompareOperation.Equals: return(target.Value == op1.Value); default: GameManager.DebugLog("Error - operator invalid"); break; } return(false); }
private Resource GetByFixedValue(Resource res, int p) { bool bv = false; int iv = 0; string sv = null; if (p == 0) { GameManager.DebugLog("Eror - Invalid fixed value on Target resource"); } if (p == 1) { bv = bool_mod; iv = number_mod; sv = text_mod; } if (p == 2) { bv = bool_mod2; iv = number_mod2; sv = text_mod2; } Resource return_resource = null; if (res is ResourceAction) { GameManager.DebugLog("Modifying a Resource Action is not currently supported"); return(null); } else if (res is ResourceBool) { return_resource = new ResourceBool(); (return_resource as ResourceBool).Value = bv; } else if (res is ResourceNumber) { return_resource = new ResourceNumber(); (return_resource as ResourceNumber).Value = iv; } else if (res is ResourceText) { return_resource = new ResourceText(); (return_resource as ResourceText).Value = sv; } return(return_resource); }
private bool ModifyText(ResourceText target, ResourceText op1, ModifyOperation operation) { switch (operation) { case ModifyOperation.Set: target.Value = op1.Value; return(true); case ModifyOperation.Sum: target.Value += op1.Value; return(true); default: GameManager.DebugLog("Error - operator invalid"); break; } return(false); }