public bool CanActOn(IActiveEntity actor, IActiveEntity actee, string action) { IEnumerable <EntityActionActivationOption> actorOptions = null; IEnumerable <EntityActionActivationOption> acteeOptions; return(CanActOn(actor, actee, action, out actorOptions, out acteeOptions)); }
public EntityActionBehaviour GetEmittedAction(IActiveEntity actor, string action) { if (actor.EmittedActions != null) { return(actor.EmittedActions.Where(a => a.Action == action).FirstOrDefault()); } return(null); }
public IEnumerable <Collectible> GetItemsForActionOnEntity(IActiveEntity actee, string action) { if (AllItems == null || AllItems.Count() <= 0) { return(null); } return(AllItems.Where(c => c != null && ActiveEntityManager.Instance.CanActOn(c, actee, action)).ToList()); }
public bool CanActOn(IActiveEntity actor, IActiveEntity actee, string action, out IEnumerable <EntityActionActivationOption> actorOptions, out IEnumerable <EntityActionActivationOption> acteeOptions) { actorOptions = null; acteeOptions = null; // We only consider the first behaviour for the given action. var actorBehaviours = actor.EmittedActions == null ? null : (actor.EmittedActions.Where(a => a.Action == action).FirstOrDefault()); var acteeBehaviours = actee.ReceivedActions == null ? null : (actee.ReceivedActions.Where(a => a.Action == action).FirstOrDefault()); if (acteeBehaviours != null && actorBehaviours != null) { if (acteeBehaviours.ActivationOptions == null || acteeBehaviours.ActivationOptions.Count() == 0) { // Actee has no defined options, so any actor behaviours will work actorOptions = actorBehaviours.ActivationOptions; } else if (actorBehaviours.ActivationOptions != null) { var actorOpts = new List <EntityActionActivationOption>(); var acteeOpts = new List <EntityActionActivationOption>(); actorOptions = actorOpts; acteeOptions = acteeOpts; foreach (var a in acteeBehaviours.ActivationOptions) { foreach (var b in actorBehaviours.ActivationOptions) { if (CanExerciseOption(a, b)) { actorOpts.Add(a); acteeOpts.Add(b); } } } return(actorOpts.Count > 0 && acteeOpts.Count > 0); } } return(false); }
/// <summary> /// Returns collectibles that can perform the specified action on the actee. /// </summary> /// <param name="actee"></param> /// <param name="action"></param> /// <param name="allCatalogItems">Player's items or all possible items?.</param> /// <returns></returns> public IEnumerable <InventoryCollectible> GetItemsForActionOnEntity(IActiveEntity actee, string action, bool includeAllCatalogItems = false) { var collectibles = CollectibleDirectory.Instance.GetItemsForActionOnEntity(actee, action); return(GetItems(collectibles, includeAllCatalogItems)); }
public bool ReceivesAction(IActiveEntity actor, string action) { return(actor.ReceivedActions != null && actor.ReceivedActions.Any(a => a.Action == action)); }
public bool EmitsAction(IActiveEntity actor, string action) { return(actor.EmittedActions != null && actor.EmittedActions.Any(a => a.Action == action)); }
public bool CanTakeAction(IActiveEntity entity, string action, out IEnumerable <EntityActionActivationOption> options) { options = null; return(false); }
public bool TakeAction(IActiveEntity actor, IActiveEntity actee, string action) { return(false); }
public bool TakeAction(IActiveEntity entity) { return(false); }
public IEnumerable <T> FilterActors <T>(IEnumerable <T> actors, IActiveEntity actee, string action) where T : IActiveEntity { return(null); }