public static void CompleteInteraction(Interactable interactor, Interaction interaction){ if (interactor.Debugging) { Debug.Log ("Completing " + interaction.iName + " for " + interactor.gameObject.name); } if (interaction.HasEvent) { EventController.Event(interaction.iEvent); } GameManager.TakeTags (interaction.iTakeTags); GameManager.GiveTags (interaction.iGiveTags); GameManager.InventoryManager.TakeItemList (interaction.iTakeItems); GameManager.InventoryManager.GiveItemList (interaction.iGiveItems); interactor.DoSpecialActions (interaction.iSpecialActions); if (interaction.HasNext) { Interactable nextInteractor = interaction.NextNotSelf ? GameObject.Find (interaction.iNextInteractor).GetComponent<Interactable> () : interactor; List<Interaction> nextInteractions = nextInteractor.Interactions.FindAll (i => i.iType == InteractionType.Derivative && i.iName == interaction.iNext); if (interactor.Debugging) { Debug.Log ("Getting next interactions for " + interaction.iName + ". Valid interactions: " + nextInteractions.Count); } HandleInteractionList (nextInteractor, nextInteractions); } }
public static void HandleDrop(Interactable dropped){ List<Interaction> droppedInteractions = dropped.Interactions.FindAll (i => i.iType == InteractionType.Orange); if (dropped.Debugging) {Debug.Log ("Dropped " + dropped.gameObject.name + ". Valid interactions: " + string.Join(" ", droppedInteractions.Select(i=>i.iName).ToArray()));} if (droppedInteractions.Count > 0) { HandleInteractionList (dropped, droppedInteractions); } else { dropped.DoSpecialActions (new List<string> { "ReturnSelected" }); } }