public void AddAction(ActionListElement actionName, NextAction nextAction, ObjectInteractionController oicCaller, Collider other) { NextActionStruct NAStructToAdd = new NextActionStruct { Interaction = nextAction, oicCaller = oicCaller, other = other }; switch (actionName) { case ActionListElement.HIDE: hideActionList.Add(NAStructToAdd); break; case ActionListElement.INTERACT: interactActionList.Add(NAStructToAdd); break; case ActionListElement.DASH: dashActionList.Add(NAStructToAdd); break; case ActionListElement.USE: useActionList.Add(NAStructToAdd); break; default: break; } }
public void RemoveAction(ActionListElement actionName, NextAction nextAction, ObjectInteractionController oicCaller, Collider other) { List <NextActionStruct> listToRemoveFrom; switch (actionName) { case ActionListElement.HIDE: listToRemoveFrom = hideActionList; break; case ActionListElement.INTERACT: listToRemoveFrom = interactActionList; break; case ActionListElement.DASH: listToRemoveFrom = dashActionList; break; case ActionListElement.USE: listToRemoveFrom = useActionList; break; default: listToRemoveFrom = null; break; } if (listToRemoveFrom != null) { for (int i = 0; i < listToRemoveFrom.Count; i++) { NextActionStruct currNAS = listToRemoveFrom[i]; if (oicCaller == currNAS.oicCaller && other == currNAS.other && nextAction == currNAS.Interaction) { listToRemoveFrom.Remove(currNAS); break; } } } }
public void DoAction(ActionListElement actionName) { switch (actionName) { case ActionListElement.HIDE: if (hideActionList.Count != 0) { NextActionStruct NAStruct = hideActionList[0]; NAStruct.Interaction(NAStruct.oicCaller, NAStruct.other); } break; case ActionListElement.INTERACT: if (interactActionList.Count != 0) { NextActionStruct NAStruct = interactActionList[0]; NAStruct.Interaction(NAStruct.oicCaller, NAStruct.other); } break; case ActionListElement.DASH: if (dashActionList.Count != 0) { NextActionStruct NAStruct = dashActionList[0]; NAStruct.Interaction(NAStruct.oicCaller, NAStruct.other); } break; case ActionListElement.USE: if (useActionList.Count != 0) { NextActionStruct NAStruct = useActionList[0]; NAStruct.Interaction(NAStruct.oicCaller, NAStruct.other); } break; default: break; } }