示例#1
0
        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
        }
示例#2
0
 public Interaction(PowerName power, Actor target, InteractSuccessCallback success,
                    AIEventCallback callback)
 {
     Power    = power;
     Target   = target;
     Success  = success;
     Callback = callback;
     Started  = DateTime.UtcNow;
 }