/// <summary>
 /// Removes the given source if its <see cref="ActionSource.Container"/> matches the given limit.
 /// </summary>
 /// <param name="source">The source to try to remove.</param>
 /// <param name="limit">The limit to try to match against any <see cref="ActionSource.Container"/>.</param>
 protected virtual void TryRemoveTargetSource(ActionSource source, GameObject limit)
 {
     if (limit == source.Container)
     {
         Target.RemoveSource(source.Action);
     }
 }
 protected virtual void OnSourceRemoved(ActionSource source)
 {
     foreach (GameObject limit in SourceLimits.SubscribableElements)
     {
         TryRemoveTargetSource(source, limit);
     }
 }
        public void sync_int_returning_action_is_action_candidate()
        {
            var method = typeof(StatusCodeEndpoint).GetMethod(nameof(StatusCodeEndpoint.get_status1),
                                                              BindingFlags.Public | BindingFlags.Static);

            ActionSource.IsCandidate(method).ShouldBeTrue();
        }
示例#4
0
    public void ExecutePlan()
    {
        if (m_actionSource == null || m_actionSource.Action == null || m_state != EntityState.Alive)
        {
            return;
        }

        if (m_currentAction != null)
        {
            m_currentAction.End();
            m_currentAction = null;
        }

        m_actionQueue.Clear();

        ActionSource currentSource = m_actionSource;

        while (currentSource != null && currentSource.Action != null)
        {
            m_actionQueue.Enqueue(currentSource.Action);
            currentSource = currentSource.Action.ChildSource;
        }

        m_planQueue.Clear();
        Debug.Log("Executing plan " + m_actionQueue.Count);
    }
 /// <summary>
 /// Adds the given source if its <see cref="ActionSource.Container"/> matches the given limit.
 /// </summary>
 /// <param name="source">The source to try to add.</param>
 /// <param name="limit">The limit to try to match against any <see cref="ActionSource.Container"/>.</param>
 protected virtual void TryAddTargetSource(ActionSource source, GameObject limit)
 {
     if (source.Enabled && (limit == null || limit == source.Container))
     {
         Target.AddSource(source.Action);
     }
 }
        /// <summary>
        /// Create an adhoc policy for discovering actions
        /// </summary>
        /// <param name="configuration"></param>
        public ActionCallCandidateExpression FindBy(Action <ActionSource> configuration)
        {
            var source = new ActionSource();

            configuration(source);

            return(FindWith(source));
        }
 public void SetUp()
 {
     source = new ActionSource();
     _graph = new Lazy <BehaviorGraph>(() => {
         return(BehaviorGraph.BuildFrom(r => {
             r.Actions.FindWith(source);
         }));
     });
 }
示例#8
0
        private IEnumerable <ActionCall> findActions()
        {
            var source = new ActionSource();

            PackageRegistry.PackageAssemblies.Each(a => source.Applies.ToAssembly(a));
            source.IncludeTypesNamed(name => name.EndsWith("FubuDiagnostics"));

            return(source.As <IActionSource>().FindActions(null));
        }
示例#9
0
 public void SetUp()
 {
     source = new ActionSource();
     _graph =
         new Lazy <BehaviorGraph>(() => BehaviorGraph.BuildFrom(r =>
     {
         r.Actions.DisableDefaultActionSource();
         r.Actions.FindWith(source);
     }));
 }
示例#10
0
        private Task <ActionCall[]> findActions(BehaviorGraph graph)
        {
            var source = new ActionSource();

            source.Applies.ToAssemblyContainingType <IActionBehavior>();
            graph.PackageAssemblies.Each(a => source.Applies.ToAssembly(a));
            source.IncludeTypesNamed(name => name.EndsWith("FubuDiagnostics"));
            source.IncludeTypes(type => type == typeof(FubuDiagnosticsEndpoint));

            return(source.As <IActionSource>().FindActions(null));
        }
示例#11
0
        public void SetUp()
        {
            TypePool.FindTheCallingAssembly().FullName.ShouldEqual(Assembly.GetExecutingAssembly().FullName);

            source = new ActionSource();
            _graph = new Lazy <BehaviorGraph>(() => {
                return(BehaviorGraph.BuildFrom(r => {
                    r.Actions.FindWith(source);
                }));
            });
        }
 /// <summary>
 /// Sets the enabled state of an <see cref="ActionSource"/>.
 /// </summary>
 /// <param name="source">The source to match the container to set the state of.</param>
 /// <param name="state">The state to set enabled to.</param>
 /// <param name="setAll">Determines whether to ignore the source and just set all sources to the given state.</param>
 protected virtual void SetSourceEnabledState(GameObject source, bool state, bool setAll = false)
 {
     for (int i = 0; i < sources.Count; i++)
     {
         ActionSource actionSource = sources[i];
         if (actionSource.container == source || setAll)
         {
             actionSource.enabled = state;
         }
         sources[i] = actionSource;
     }
 }
示例#13
0
        public bool ActionSnapshotRestore(ActionSource actionSource, EngineSnapshot snapshot, params object[] args)
        {
            Logger.Information(MethodBase.GetCurrentMethod().DeclaringType.Name, ".", MethodBase.GetCurrentMethod().Name);

            args = new object[] { actionSource, snapshot }.Concat(args).ToArray();
            if (OnActionSnapshotRestore.Call(args).First() is bool b)
            {
                return(b);
            }

            return(false);
        }
        public ActionCallCandidateExpression(ActionMethodFilter methodFilter, ConfigurationGraph configuration)
        {
            _methodFilter  = methodFilter;
            _configuration = configuration;
            _mainSource    = new Lazy <ActionSource>(() =>
            {
                var source = new ActionSource(_methodFilter);
                configuration.AddActions(source);

                return(source);
            });
        }
示例#15
0
    // Use this for initialization
    protected override void Start()
    {
        base.Start();
        m_actionSource = GetComponent <ActionSource>();

        m_actionSource.SetEntity(this);

        m_actionSource = GetComponent <ActionSource>();
        TestWeapon weapon = (TestWeapon)m_currentWeapon;

        weapon.AlwaysFiring = true;
    }
示例#16
0
        public ActionCallCandidateExpression(IList <IActionSource> sources, ActionMethodFilter methodFilter)
        {
            _methodFilter = methodFilter;
            _mainSource   = new Lazy <ActionSource>(() =>
            {
                var source = new ActionSource(_methodFilter);
                sources.Insert(0, source);

                return(source);
            });

            _sources = sources;
        }
示例#17
0
        public void SetUp()
        {
            matcher = new ActionSource(new ActionMethodFilter());

            pool = new TypePool(null);
            pool.IgnoreCallingAssembly();

            pool.AddType <DifferentPatternClass>();
            pool.AddType <OneController>();
            pool.AddType <TwoController>();
            pool.AddType <ThreeController>();

            calls = null;
        }
示例#18
0
        public AbilityConfig(DataEntry data)
        {
            ID = data.ID;
            var itemType = data.Get <DataReference>(DatabaseFields.ItemType);

            Name        = data.GetValue <string>(DatabaseFields.Name);
            Description = data.TryGetValue(DatabaseFields.Description, Name);
            Icon        = "A_" + data.GetValue <string>(DatabaseFields.Icon);
            Source      = ParseUtilities.TryParseEnum(data.TryGetValue("ActionSource", ""), ActionSource.Melee);
            Target      = ParseUtilities.TryParseEnum(data.TryGetValue("TargetType", "Enemy"), TargetType.Enemy);
            var range = data.TryGetValue("Range", "Medium");
            var cost  = data.TryGetValue("Cost", 1f);

            Level          = data.TryGetValue("Level", 1);
            CommandType    = ParseUtilities.TryParseEnum(data.TryGetValue(DatabaseFields.Radius, "Command"), ActionCommandType.Attack);
            Skill          = data.TryGetValue(DatabaseFields.Skill, "");
            TypeComponents = itemType?.Value.Get(DatabaseFields.Components) as DataList;
            Data           = data;
            //CommandsElements.Add(new DetermineHitOrMiss(ActionStateEvents.None));
            //if (!string.IsNullOrEmpty(Animation)) {
            //    CommandsElements.Add(new WaitForAnimation(ActionStateEvents.None, Animation, _defaultAnimationTimeout, true, false));
            //}
            //if (data.Get<DataReference>(DatabaseFields.Projectile) != null) {
            //    CommandsElements.Add(new WaitForSpawnMovement(ActionStateEvents.None));
            //}
            //CommandsElements.Add(new GenerateCollisionEvent(ActionStateEvents.Activate));
            var radius = ParseUtilities.TryParseEnum(data.TryGetValue(DatabaseFields.Radius, "Single"), ImpactRadiusTypes.Single);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("<b>Power:</b> ");
            sb.Append(data.TryGetValue(DatabaseFields.PowerMin, 0f));
            sb.Append(data.TryGetValue(DatabaseFields.PowerMax, 1f));
            sb.Append("<b>Cost:</b> ");
            sb.Append(cost.ToString("F0"));
            sb.Append(" ");
            sb.Append(GameData.Vitals.GetNameAt("Vitals.Energy"));
            sb.Append(System.Environment.NewLine);
            sb.Append("<b>Targeting:</b> ");
            sb.NewLineAppend(Target.ToDescription());
            sb.Append("<b>Radius:</b> ");
            sb.NewLineAppend(radius.ToDescription());
            sb.Append("<b>Range:</b> ");
            sb.NewLineAppend(range);
            sb.Append("<b>Recovery:</b> ");
            sb.NewLineAppend(CommandType.ToDescription());
            DataDescription = sb.ToString();
        }
示例#19
0
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$");
            parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$");
            parameters.Add(Name != null ? Name.ToStepValue() : "$");
            parameters.Add(Description != null ? Description.ToStepValue() : "$");
            parameters.Add(ObjectType != null ? ObjectType.ToStepValue() : "$");
            parameters.Add(PredefinedType.ToStepValue());
            parameters.Add(ActionType.ToStepValue());
            parameters.Add(ActionSource.ToStepValue());
            parameters.Add(Coefficient != null ? Coefficient.ToStepValue() : "$");
            parameters.Add(Purpose != null ? Purpose.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
示例#20
0
 private void Awake()
 {
     actionSource = new ActionSource <Shape>((shape) => () => system.Remove(shape.transform));
 }
示例#21
0
        public static ActionSource ForBottles(this ActionSource source, Action <Assembly> action)
        {
            action.ForBottles();

            return(source);
        }
 private static void UpdateImmunitiesList(bool sourceTypeBool, List <ActionSource> immunitiesList, ActionSource source)
 {
     if (sourceTypeBool && !immunitiesList.Contains(source))
     {
         immunitiesList.Add(source);
     }
     else if (!sourceTypeBool && immunitiesList.Contains(source))
     {
         immunitiesList.Remove(source);
     }
 }
        public void async_int_returning_action_is_action_candidate()
        {
            var method = ReflectionHelper.GetMethod <StatusCodeEndpoint>(x => x.get_status2());

            ActionSource.IsCandidate(method).ShouldBeTrue();
        }
示例#24
0
 private void Awake()
 {
     configurators       = GetComponentsInChildren <ISatelliteConfigurator>();
     spawnedActionSource = new ActionSource <Shape>((shape) => () => scaleSystem.Remove(shape.transform));
 }
示例#25
0
 public static ActionSource IncludeTypeNamesSuffixed(this ActionSource source, params string[] suffix)
 {
     source.IncludeTypes(y => suffix.Any(z => y.Name.EndsWith(z)));
     return(source);
 }
示例#26
0
 public void Initialize()
 {
     _actionSrouce = new ActionSource();
 }
示例#27
0
 public void methods_are_candidate_actions()
 {
     ActionSource.IsCandidate(ReflectionHelper.GetMethod <RoutedEndpoint>(x => x.get_with_date_time(DateTime.MinValue))).ShouldBeTrue();
     ActionSource.IsCandidate(ReflectionHelper.GetMethod <RoutedEndpoint>(x => x.get_with_dateoffset_time(DateTimeOffset.MaxValue))).ShouldBeTrue();
     ActionSource.IsCandidate(ReflectionHelper.GetMethod <RoutedEndpoint>(x => x.get_with_number_value(55))).ShouldBeTrue();
 }
示例#28
0
 public ChangeSourcesActionNode(ActionSource action, DecisionTree tree)
     : base(() => { tree.AddActionSource(action); return false; }, tree)
 {
 }
 public PerformanceActionEvent(ActionType actionType, string trackerName = null, ActionSource source = ActionSource.Scripting)
 {
     this.actionType  = actionType;
     this.trackerName = trackerName;
     actionSource     = source;
 }
示例#30
0
 public static ActionSource IncludeMethodsPrefixed(this ActionSource source, params string[] prefix)
 {
     source.IncludeMethods(y => prefix.Any(z => y.Name.StartsWith(z)));
     return(source);
 }
 public void Update(ActionSource entity, int LoggedInUserId, int LoggedInOrganizationId)
 {
     base.Update(entity);
     _unitOfWork.Save();
 }