Example #1
0
        public override void Init(IReGoapMemory <string, object> memory)
        {
            base.Init(memory);
            var state = memory.GetWorldState();

            state.Set("startPosition", transform.position);
        }
Example #2
0
    private void Tick()
    {
        possibleGoalsDirty = true;

        if (currentActionState == null)
        {
            if (!IsPlanning)
            {
                CalculateNewGoal();
            }
            return;
        }
        // check if current action preconditions are still valid, else invalid action and restart planning
        if (ValidateActiveAction)
        {
            var state = memory.GetWorldState();
            if (!currentActionState.Action.GetPreconditions(state, currentActionState.Settings).Difference(state, true).IsEmpty())
            {
                TryWarnActionFailure(currentActionState);
            }
        }
    }