public void TestRemoveActionMatrixCell() { ActionMatrix actionMatrix = new ActionMatrix(); RoutingItemCollection senders1 = new RoutingItemCollection(Guid.NewGuid(), "Senders1"); RoutingItemCollection senders2 = new RoutingItemCollection(Guid.NewGuid(), "Senders2"); RoutingItemCollection recipients1 = new RoutingItemCollection(Guid.NewGuid(), "Recipients1"); RoutingItemCollection recipients2 = new RoutingItemCollection(Guid.NewGuid(), "Recipients2"); Assert.AreEqual(0, actionMatrix.CellCount); actionMatrix[senders1, recipients1] = new ActionMatrixCell(senders1, recipients1); actionMatrix[senders1, recipients2] = new ActionMatrixCell(senders1, recipients2); actionMatrix[senders2, recipients2] = new ActionMatrixCell(senders2, recipients2); Assert.AreEqual(3, actionMatrix.CellCount); Assert.IsTrue(actionMatrix.HasCell(senders1, recipients1)); Assert.IsTrue(actionMatrix.HasCell(senders1, recipients2)); Assert.IsTrue(actionMatrix.HasCell(senders2, recipients2)); actionMatrix.Remove(senders1, recipients2); Assert.AreEqual(2, actionMatrix.CellCount); Assert.IsTrue(actionMatrix.HasCell(senders1, recipients1)); Assert.IsFalse(actionMatrix.HasCell(senders1, recipients2)); Assert.IsTrue(actionMatrix.HasCell(senders2, recipients2)); }
public int[] GetModForTick(int i) { BitArray protectionArray = new BitArray(GameManager.SPACE_SIZE); ActionMatrix.TryGetValue(ActionType.PROTECTION, out protectionArray); BitArray tempArray = new BitArray(GameManager.SPACE_SIZE); ActionMatrix.TryGetValue(ActionType.TEMPERATURE, out tempArray); BitArray fuelArray = new BitArray(GameManager.SPACE_SIZE); ActionMatrix.TryGetValue(ActionType.CONSUME, out fuelArray); int[] mod = new int[4]; //PROTECTION if (protectionArray[i] == true) { mod[(int)ActionType.PROTECTION] = 2; mod[(int)ActionType.CONSUME] = -1; mod[(int)ActionType.TEMPERATURE] = 2; } else { mod[(int)ActionType.PROTECTION] = 0; mod[(int)ActionType.CONSUME] = 0; mod[(int)ActionType.TEMPERATURE] = 0; } //TEMPERATURE if (tempArray[i] == true) { mod[(int)ActionType.PROTECTION] += -1; mod[(int)ActionType.CONSUME] += -1; mod[(int)ActionType.TEMPERATURE] += -1; } else { mod[(int)ActionType.PROTECTION] += 0; mod[(int)ActionType.CONSUME] += 0; mod[(int)ActionType.TEMPERATURE] += 0; } //FUEL if (fuelArray[i] == true) { mod[(int)ActionType.PROTECTION] += -1; mod[(int)ActionType.CONSUME] += 2; mod[(int)ActionType.TEMPERATURE] += -2; } else { mod[(int)ActionType.PROTECTION] += 0; mod[(int)ActionType.CONSUME] += 0; mod[(int)ActionType.TEMPERATURE] += 0; } return(mod); }
public void SetActionMatrix(IEnumerable <ActionMatrixEntry> entries) { ActionMatrix.Clear(); foreach (var entry in entries) { ActionMatrix[entry.Key] = entry; } }
private void ReadActionMatrix(XmlNode actionMatrixNode, ActionMatrix actionMatrix, bool readOnly) { XmlNodeList actionMatrixCellNodeList = actionMatrixNode.SelectNodes("*"); foreach (XmlNode actionMatrixCellNode in actionMatrixCellNodeList) { ReadOfflineActionMatrixCell(actionMatrixCellNode, actionMatrix, readOnly); ReadActionExceptionCell(actionMatrixCellNode, actionMatrix, readOnly); ReadActionMatrixCell(actionMatrixCellNode, actionMatrix, readOnly); } }
public EntityRules ToEntityRules() { var entity = new EntityRules(m_name, StringLookup.ToStringLookup()); entity.PreBattleEffects = m_preBattleEffectsNode.GetChildren().Select(x => x.ToEffectBase()).ToList().AsReadOnly(); entity.PostBattleEffects = m_postBattleEffectsNode.GetChildren().Select(x => x.ToEffectBase()).ToList().AsReadOnly(); entity.PreTurnEffects = m_preTurnEffectsNode.GetChildren().Select(x => x.ToEffectBase()).ToList().AsReadOnly(); entity.PostTurnEffects = m_postTurnEffectsNode.GetChildren().Select(x => x.ToEffectBase()).ToList().AsReadOnly(); entity.EliminationCondition = m_eliminationCondition.ToConditionBase(); entity.Actions = m_actionsNode.GetChildren().Select(x => x.ToAction()).ToList().AsReadOnly(); entity.Results = m_resultsNode.GetChildren().Select(x => x.ToResult()).ToList().AsReadOnly(); entity.SetActionMatrix(ActionMatrix.ToActionMatrixEntries()); return(entity); }
private void ReadOfflineActionMatrixCell(XmlNode actionMatrixCellNode, ActionMatrix actionMatrix, bool readOnly) { if ((null == actionMatrixCellNode) || (null == actionMatrix) || ("Offline" != actionMatrixCellNode.Name)) return; bool actionMatrixCellReadOnly = PolicyUtilities.IsReadOnly(actionMatrixCellNode) || readOnly; PolicyCataloguesCache policyCataloguesCache = PolicyCataloguesCache.Instance(); OfflineActionMatrixCell actionMatrixCell = new OfflineActionMatrixCell(); ReadActionMatrixConditions(actionMatrixCellNode, actionMatrixCell, actionMatrixCellReadOnly); actionMatrix.Offline = actionMatrixCell.DeepCopy(actionMatrixCellReadOnly) as IActionMatrixCell; }
public Result GetResult(string attackerActionKey, string defenderActionKey) { ActionMatrixEntry entry; if (ActionMatrix.TryGetValue(new ActionMatrixEntryKey(attackerActionKey, defenderActionKey), out entry)) { var result = Results.FirstOrDefault(x => x.Key == entry.ResultId); if (result == null) { throw new InvalidRulesException($"Entity '{RenderForLog()}' is missing result '{entry.ResultId}'."); } return(result); } throw new InvalidRulesException($"Entity '{RenderForLog()}' is missing entries in the action matrix. Attacker='{attackerActionKey}', Defender='{defenderActionKey}'"); }
private void ReadActionMatrixCell(XmlNode actionMatrixCellNode, ActionMatrix actionMatrix, bool readOnly) { if ((null == actionMatrixCellNode) || (null == actionMatrix) || ("ActionMatrixCell" != actionMatrixCellNode.Name)) return; string senderId = actionMatrixCellNode.Attributes.GetNamedItem("SourceRoutingItemCollectionId").InnerText; string recipientId = actionMatrixCellNode.Attributes.GetNamedItem("DestinationRoutingItemCollectionId").InnerText; bool actionMatrixCellReadOnly = PolicyUtilities.IsReadOnly(actionMatrixCellNode) || readOnly; PolicyCataloguesCache policyCataloguesCache = PolicyCataloguesCache.Instance(); IRoutingItemCollection senders = policyCataloguesCache.LocationsCollections[new Guid(senderId)]; IRoutingItemCollection recipients = policyCataloguesCache.LocationsCollections[new Guid(recipientId)]; ActionMatrixCell actionMatrixCell = new ActionMatrixCell(senders, recipients); ReadActionMatrixConditions(actionMatrixCellNode, actionMatrixCell, actionMatrixCellReadOnly); actionMatrix[senderId, recipientId] = actionMatrixCell.DeepCopy(actionMatrixCellReadOnly) as IActionMatrixCell; }
public override void Read() { PolicyChannel policyChannel = m_parent as PolicyChannel; if(policyChannel == null) throw new Workshare.Policy.Exceptions.ArgumentNullException("policyChannel", "Expected the parent object to be of type PolicyChannel"); XmlElement root = m_reader.PolicyDocument.DocumentElement; XmlNode actionMatrixNode = root.SelectSingleNode(m_xpath); if (actionMatrixNode == null) return; List<string> exclusions = new List<string>(); exclusions.Add("readonly"); XmlAttributeCollection attributes = actionMatrixNode.Attributes; bool readOnly = PolicyUtilities.IsReadOnly(actionMatrixNode); ActionMatrix actionMatrix = new ActionMatrix(readOnly); new XmlCustomAttributesReader(actionMatrix, attributes, exclusions).Read(); ReadActionMatrix(actionMatrixNode, actionMatrix, readOnly); policyChannel.Actions = actionMatrix; }
public void TestAddActionPreAddToChannel() { IPolicyLanguage language = new PolicyLanguage(new Guid("{E8B22533-98EB-4D00-BDE4-406DC3E1858B}"), "en"); XMLPolicyCatalogueStore catalogueStore = XMLPolicyCatalogueStore.Instance; catalogueStore.Reset(); PolicyCatalogue policyCatalogue = new PolicyCatalogue(new Guid("{AB5E2A43-01FB-4AA6-98FC-8F74BB0621CA}"), language.Identifier, new TranslateableLanguageItem("{B5C31A66-1B39-4CA7-BF02-AF271B5864F7}"), catalogueStore); catalogueStore.AddPolicyCatalogue(policyCatalogue); PolicySetObserver policySetObserver = new PolicySetObserver(policyCatalogue); Assert.AreEqual(0, policyCatalogue.Channels.Count); Assert.AreEqual(0, policyCatalogue.ActionGroups.Count); Assert.AreEqual(0, policyCatalogue.Actions.Count); Assert.AreEqual(0, policyCatalogue.LocationsCollection.Count); Assert.AreEqual(0, policyCatalogue.Locations.Count); PolicyChannel channel = new PolicyChannel(new Guid("{0FE26539-7AAD-46DC-8D5B-9651CC00B9E4}"), new TranslateableLanguageItem("Test channel"), ChannelType.SMTP); policySetObserver.AddObject(channel); IRoutingItemCollection senders = new RoutingItemCollection(new Guid("{441FDCBF-B606-4325-8CD5-E829AD5303B9}"), "Test sources"); IRoutingItemCollection recipients = new RoutingItemCollection(new Guid("{29C44E5C-5405-409F-8513-A99AE246536F}"), "Test destinations"); ActionMatrix actionMatrix = new ActionMatrix(); channel.Actions = actionMatrix; ActionMatrixCell actionMatrixCell = new ActionMatrixCell(senders, recipients); actionMatrix[senders, recipients] = actionMatrixCell; ConditionGroup conditionGroup = new ConditionGroup(new Guid("{9D065722-1106-4FC1-8D48-58733661B929}"), new TranslateableLanguageItem("Test condition group"), ConditionLogic.AND, false); ActionGroup actionGroup = new ActionGroup(new Guid("{E2A16C4D-E112-4249-92B9-612732117809}"), new TranslateableLanguageItem("Test action group"), 1); Action action = new Action(new Guid("{A5FAA63E-4F25-456F-92F9-9BB465C18F1F}"), "Test.dll", "Do.It", RunAt.Client, false, 1); //TODO JE ActionConditionGroup actionConditionGroup = new ActionConditionGroup(conditionGroup, actionGroup, false); actionMatrixCell.ActionConditionGroups.Add(actionConditionGroup); actionGroup.Actions.Add(action); Assert.AreEqual(1, policyCatalogue.Channels.Count, "Expected one channel"); Assert.AreEqual(1, policyCatalogue.ActionGroups.Count, "Expected one action group"); Assert.AreEqual(1, policyCatalogue.Actions.Count, "Expected one action"); Assert.AreEqual(2, policyCatalogue.LocationsCollection.Count, "Expected two location groups"); Assert.AreEqual(0, policyCatalogue.Locations.Count, "Expected no locations"); }
public static void BuildActionMatrix(IPolicy policy, ActionMatrix actionMatrix, ActionGroup actionGroup) { ConditionGroup conditionGroup = new ConditionGroup(new Guid("{661EDD6F-D750-493A-9932-E56C8C22E2CF}"), new TranslateableLanguageItem("Test condition group"), ConditionLogic.AND, false); policy.Conditions.Add(conditionGroup); PolicyCataloguesCache policyCataloguesCache = PolicyCataloguesCache.Instance(); IRoutingItemCollection senders1 = policyCataloguesCache.LocationsCollections[new Guid("{A81631A6-6AA3-45F7-AADD-4853447E5BD6}")]; IRoutingItemCollection senders2 = policyCataloguesCache.LocationsCollections[new Guid("{0DAACC5C-6167-42C7-AED0-55D1D9CC5096}")]; IRoutingItemCollection recipients1 = policyCataloguesCache.LocationsCollections[new Guid("{FA13BE82-9EB1-407E-9DD5-8005F3E840E4}")]; IRoutingItemCollection recipients2 = policyCataloguesCache.LocationsCollections[new Guid("{13A8EBE5-8B1E-4919-82E2-8A860DE4043E}")]; ActionMatrixCell actionMatrixCell1 = new ActionMatrixCell(senders1, recipients1); actionMatrixCell1.AddActionCondition(conditionGroup, actionGroup, false); ActionMatrixCell actionMatrixCell2 = new ActionMatrixCell(senders1, recipients2); actionMatrixCell1.AddActionCondition(conditionGroup, actionGroup, false); actionMatrix[senders1, recipients1] = actionMatrixCell1; actionMatrix[senders1, recipients2] = actionMatrixCell2; ConditionGroup conditionGroup2 = new ConditionGroup(new Guid("{D64056E5-A19D-4B29-8F4A-A70337B42A19}"), new TranslateableLanguageItem("Test condition group 2"), ConditionLogic.AND, false); policy.Conditions.Add(conditionGroup2); ActionMatrixCell actionMatrixCell3 = new ActionMatrixCell(senders2, recipients2); actionMatrixCell3.AddActionCondition(conditionGroup2, actionGroup, false); ActionMatrixCell actionMatrixCell4 = new ActionMatrixCell(senders2, recipients1); actionMatrixCell4.AddActionCondition(conditionGroup2, actionGroup, false); actionMatrix[senders2, recipients2] = actionMatrixCell3; actionMatrix[senders2, recipients1] = actionMatrixCell4; }
public static void BuildActionMatrix(IPolicy policy, ActionMatrix actionMatrix, ActionGroup actionGroup, IRoutingItemCollections senders, IRoutingItemCollections recipients) { ConditionGroup conditionGroup = new ConditionGroup(new Guid("{661EDD6F-D750-493A-9932-E56C8C22E2CF}"), new TranslateableLanguageItem("Test condition group"), ConditionLogic.AND, false); policy.Conditions.Add(conditionGroup); // Just fill out each cell with the same condition group for now... int i = 0; foreach (IRoutingItemCollection senderCollection in senders) { foreach (IRoutingItemCollection recipientCollection in recipients) { ActionMatrixCell cell = new ActionMatrixCell(senderCollection, recipientCollection); cell.AddActionCondition(conditionGroup, actionGroup, false); actionMatrix[senderCollection, recipientCollection] = cell; i++; } } }
private IActionMatrix BuildActionMatrix(IPolicy policy, bool readOnly) { ActionMatrix actionMatrix = new ActionMatrix(readOnly); TestHelpers.BuildActionMatrix(policy, actionMatrix, BuildActionGroup()); return actionMatrix; }
private void BuildPolicy(IPolicy policy) { IConditionGroup conditionGroup = new ConditionGroup(Guid.NewGuid(), new TranslateableLanguageItem(""), ConditionLogic.AND, false); policy.Conditions.Add(conditionGroup); ICondition condition = new Condition(Guid.NewGuid(), "TestClass", new TranslateableLanguageItem(""), OperatorType.Equals); conditionGroup.Conditions.Add(condition); condition.Parent = conditionGroup; DataMethod dataMethod = new DataMethod("ThisIsATest"); DataElement parameterDataElement = new DataElement(Guid.NewGuid(), new TranslateableLanguageItem(""), new NonTranslateableLanguageItem(""), DataType.String, "Lets go dynamo"); dataMethod.Parameters.Add(new Parameter("somethingTerrible", parameterDataElement)); IDataSource dataSource = new DataSource("ThisIsADodgyAssembly.dll", "ItWantsToTakeOverYourComputer", dataMethod); condition.DataLeft = new DataElement(Guid.NewGuid(), new TranslateableLanguageItem(""), new NonTranslateableLanguageItem(""), DataType.Object, dataSource); IDataItem dataRightDataItem = DataItem.CreateDataItem(new TranslateableLanguageItem(""), DataType.String, "This is a test"); condition.DataRight = new DataElement(Guid.NewGuid(), new TranslateableLanguageItem(""), new NonTranslateableLanguageItem(""), DataType.String, dataRightDataItem); //Now build a channel PolicyChannel channel = new PolicyChannel(Guid.NewGuid(), new TranslateableLanguageItem(""), ChannelType.SMTP); policy.Channels.Add(channel); RoutingTable routingTable = new RoutingTable(Guid.NewGuid(), new TranslateableLanguageItem(""), ChannelType.SMTP); channel.Routing = routingTable; IRoutingItemCollection senders = new RoutingItemCollection(Guid.NewGuid(), ""); senders.Add(new RoutingItem(Guid.NewGuid(), "James Brown", "*****@*****.**")); senders.Add(new RoutingItem(Guid.NewGuid(), "Nat King Cole", "*****@*****.**")); IRoutingItemCollection recipients = new RoutingItemCollection(Guid.NewGuid(), ""); recipients.Add(new RoutingItem(Guid.NewGuid(), "Jet Li", "*****@*****.**")); routingTable.Sources.Add(senders); routingTable.Destinations.Add(recipients); ActionMatrix actionMatrix = new ActionMatrix(false); channel.Actions = actionMatrix; ActionMatrixCell actionMatrixCell = new ActionMatrixCell(senders, recipients); actionMatrix[senders, recipients] = actionMatrixCell; ConditionGroup conditionGroup2 = new ConditionGroup(Guid.NewGuid(), new TranslateableLanguageItem(""), ConditionLogic.AND, false); ActionGroup actionGroup = new ActionGroup(Guid.NewGuid(), new TranslateableLanguageItem(""), 1); IActionConditionGroup actionConditionGroup = new ActionConditionGroup(conditionGroup2, actionGroup, false); actionMatrixCell.ActionConditionGroups.Add(actionConditionGroup); Action action = new Action(Guid.NewGuid(), new TranslateableLanguageItem(""), "TestAction.dll", "Test.Action", RunAt.Client, false, 1); //TODO JE DataItem dataItem = DataItem.CreateDataItem(new TranslateableLanguageItem(""), DataType.String, "Not again, when will it ever end!"); DataElement dataElement = new DataElement(Guid.NewGuid(), new TranslateableLanguageItem(""), new TranslateableLanguageItem(""), DataType.String, dataItem); action.DataElements.Add(dataElement); actionConditionGroup.ActionGroup.Actions.Add(action); //Setup the Action Exception ConditionGroup conditionGroup3 = new ConditionGroup(Guid.NewGuid(), new TranslateableLanguageItem(""), ConditionLogic.AND, false); ActionGroup actionGroup3 = new ActionGroup(Guid.NewGuid(), new TranslateableLanguageItem(""), 1); IActionConditionGroup actionConditionGroup3 = new ActionConditionGroup(conditionGroup3, actionGroup3, false); Action action3 = new Action(Guid.NewGuid(), new TranslateableLanguageItem(""), "TestAction.dll", "Test.Action", RunAt.Client, false, 1); actionConditionGroup3.ActionGroup.Actions.Add(action3); actionMatrix.ActionExceptionHandler.ActionConditionGroups.Add(actionConditionGroup3); //Setup the Offline Actions ConditionGroup conditionGroup4 = new ConditionGroup(Guid.NewGuid(), new TranslateableLanguageItem(""), ConditionLogic.AND, false); ActionGroup actionGroup4 = new ActionGroup(Guid.NewGuid(), new TranslateableLanguageItem(""), 1); IActionConditionGroup actionConditionGroup4 = new ActionConditionGroup(conditionGroup4, actionGroup4, false); Action action4 = new Action(Guid.NewGuid(), new TranslateableLanguageItem(""), "TestAction.dll", "Test.Action", RunAt.Client, false, 1); actionConditionGroup4.ActionGroup.Actions.Add(action4); actionMatrix.Offline.ActionConditionGroups.Add(actionConditionGroup4); }
private void AddActionPostAddToChannel(out PolicyChannel channel, out PolicyCatalogue policyCatalogue) { IPolicyLanguage language = new PolicyLanguage(new Guid("{E8B22533-98EB-4D00-BDE4-406DC3E1858B}"), "en"); XMLPolicyCatalogueStore catalogueStore = XMLPolicyCatalogueStore.Instance; catalogueStore.Reset(); policyCatalogue = new PolicyCatalogue(new Guid("{AB5E2A43-01FB-4AA6-98FC-8F74BB0621CA}"), language.Identifier, new TranslateableLanguageItem("{B5C31A66-1B39-4CA7-BF02-AF271B5864F7}"), catalogueStore); catalogueStore.AddPolicyCatalogue(policyCatalogue); PolicySetObserver policySetObserver = new PolicySetObserver(policyCatalogue); Assert.AreEqual(0, policyCatalogue.Channels.Count); Assert.AreEqual(0, policyCatalogue.ActionGroups.Count); Assert.AreEqual(0, policyCatalogue.Actions.Count); Assert.AreEqual(0, policyCatalogue.LocationsCollection.Count); Assert.AreEqual(0, policyCatalogue.Locations.Count); channel = new PolicyChannel(new Guid("{0FE26539-7AAD-46DC-8D5B-9651CC00B9E4}"), new TranslateableLanguageItem("Test channel"), ChannelType.SMTP); policySetObserver.AddObject(channel); IRoutingItemCollection senders = new RoutingItemCollection(new Guid("{441FDCBF-B606-4325-8CD5-E829AD5303B9}"), "Test sources"); senders.Add(new RoutingItem(new Guid("{D41A47E2-CC13-46FF-BE83-829625792576}"), "James Brown", "*****@*****.**")); senders.Add(new RoutingItem(new Guid("{B031DFE9-54E7-482B-8955-18CFB8F06A40}"), "Nat King Cole", "*****@*****.**")); IRoutingItemCollection recipients = new RoutingItemCollection(new Guid("{29C44E5C-5405-409F-8513-A99AE246536F}"), "Test destinations"); recipients.Add(new RoutingItem(new Guid("{9E26C6A2-ABE2-427D-9D78-5B8547ADA8D2}"), "Jet Li", "*****@*****.**")); ActionMatrix actionMatrix = new ActionMatrix(); ActionMatrixCell actionMatrixCell = new ActionMatrixCell(senders, recipients); ConditionGroup conditionGroup = new ConditionGroup(new Guid("{9D065722-1106-4FC1-8D48-58733661B929}"), new TranslateableLanguageItem("Test condition group"), ConditionLogic.AND, false); ActionGroup actionGroup = new ActionGroup(new Guid("{E2A16C4D-E112-4249-92B9-612732117809}"), new TranslateableLanguageItem("Test action group"), 1); Action action = new Action(new Guid("{A5FAA63E-4F25-456F-92F9-9BB465C18F1F}"), "Test.dll", "Do.It", RunAt.Client, false, 1); //TODO JE ActionConditionGroup actionConditionGroup = new ActionConditionGroup(conditionGroup, actionGroup, false); actionMatrixCell.ActionConditionGroups.Add(actionConditionGroup); actionGroup.Actions.Add(action); actionMatrix[senders, recipients] = actionMatrixCell; channel.Actions = actionMatrix; }
public static IActionMatrix ActionMatrixFactory() { //TODO: can be removed when Object Model creates action matrix by default ActionMatrix actionMatrix = new ActionMatrix(); return actionMatrix; }
public void CalculateMod() { ModHP = new float[GameManager.SPACE_SIZE]; ModFUEL = new float[GameManager.SPACE_SIZE]; ModTEMP = new float[GameManager.SPACE_SIZE]; BitArray protectionArray = new BitArray(GameManager.SPACE_SIZE); ActionMatrix.TryGetValue(ActionType.PROTECTION, out protectionArray); BitArray tempArray = new BitArray(GameManager.SPACE_SIZE); ActionMatrix.TryGetValue(ActionType.TEMPERATURE, out tempArray); BitArray fuelArray = new BitArray(GameManager.SPACE_SIZE); ActionMatrix.TryGetValue(ActionType.CONSUME, out fuelArray); for (int i = 0; i < GameManager.SPACE_SIZE; i++) { /*//PROTECTION * if(protectionArray[i]==true) * { * ModHP[i] = 2; * ModFUEL[i] = 1; * ModTEMP[i] = 2; * } * else * { * ModHP[i] = 0; * ModFUEL[i] = 0; * ModTEMP[i] = 0; * } * * //TEMPERATURE * if (tempArray[i] == true) * { * ModHP[i] += -2; * ModFUEL[i] += -1; * ModTEMP[i] += +1; * } * else * { * ModHP[i] += 0; * ModFUEL[i] += 0; * ModTEMP[i] += 0; * } * * //FUEL * if (fuelArray[i] == true) * { * ModHP[i] += -1; * ModFUEL[i] += +2; * ModTEMP[i] += -2; * } * else * { * ModHP[i] += 0; * ModFUEL[i] += 0; * ModTEMP[i] += 0; * } */ var mod = this.GetModForTick(i); ModHP[i] = mod[(int)ActionType.PROTECTION]; ModFUEL[i] = mod[(int)ActionType.CONSUME]; ModTEMP[i] = mod[(int)ActionType.TEMPERATURE]; } // Debug.Log("ModHP => " + string.Join(",", ModHP.Select(x => x.ToString()).ToArray())); // Debug.Log("ModFUEL => " + string.Join(",", ModFUEL.Select(x => x.ToString()).ToArray())); // Debug.Log("ModTEMP => " + string.Join(",", ModTEMP.Select(x => x.ToString()).ToArray())); }