public void BeginInteract(World world, PowerName power, Actor target, InteractSuccessCallback success, AIEventCallback callback) { Interaction interaction = new Interaction(power, target, success, callback); // If this interaction is blacklisted or in progress, return immediately if (blacklistedInteractions.Contains(interaction)) { callback("blacklist"); return; } if (curInteraction != null) { // TODO: Should we allow actions to queue up instead? callback("busy"); return; } // Register this interaction as in-progress and run it curInteraction = interaction; world.Me.UsePower(power, target); // FIXME: We need an OnWorldUpdate event that will the in-progress interaction // and determine if it has completed, timed out, or is still in progress }
public void registerEvent(System.Type eventType, AIEventCallback callbackFunction) { if (!m_events.ContainsKey(eventType)) { m_events[eventType] = new List <AIEventCallback>(); } m_events[eventType].Add(callbackFunction); }
public Interaction(PowerName power, Actor target, InteractSuccessCallback success, AIEventCallback callback) { Power = power; Target = target; Success = success; Callback = callback; Started = DateTime.UtcNow; }
public void deregisterEvent(System.Type eventType, AIEventCallback callbackFunction) { if (!m_events.ContainsKey(eventType)) { return; } List <AIEventCallback> m_newList = new List <AIEventCallback>(); foreach (AIEventCallback f in m_events[eventType]) { if (f != callbackFunction) { m_newList.Add(f); } } m_events[eventType] = m_newList; }
public void BeginMoveTo(Actor target, AIEventCallback callback) { }
public void BeginMoveTo(Vector3f target, AIEventCallback callback) { }