public void Interact(ChoiceAsset choiceAsset) { if (CurrentInteraction == null) { Debug.LogError("Tried to interact with interactive element: " + name + " with choice: " + choiceAsset.name + " but CurrentInteraction was not set on this element. Interaction index is: " + CurrentInteractionIndex); return; } var consequencesOfThisChoice = (from c in CurrentInteraction.Consequences where c.Choice == choiceAsset select c).ToList(); if (consequencesOfThisChoice.Count == 0) { Debug.LogError("Tried to interact with interactive element: " + name + " with choice: " + choiceAsset.name + " CurrentInteraction was: " + CurrentInteraction + " but it did not contain consequences for this choice"); return; } if (consequencesOfThisChoice.Count > 1) { Debug.LogError("Tried to interact with interactive element: " + name + " with choice: " + choiceAsset.name + " CurrentInteraction was: " + CurrentInteraction + " but it contained multiple consequences for this choice"); return; } consequencesOfThisChoice[0].TriggerAllConsequences(); }
private static void InteractWith(InteractiveElementAsset asset, ChoiceAsset choice) { asset.Interact(choice); }