Exemplo n.º 1
0
        public override bool TryExecute()
        {
            if (Action.Ready())
            {
                //TODO: check all action preconditions here -- in range, resource costs, condition preconditions, etc
                // If not satisfied, add the precondition to the action stack.
                if (!Action.InRange(Target))
                {
                    //Action.Agent.GetMobilityActions();
                    //TEMP:
                    //Action.Agent.GetMoveAction().TriggerAction(Target);
                    if (Action.Agent.Mobility.MoveTarget != Target)
                    {
                        Action.Agent.Mobility.SetMoveTarget(Target, 0.1f);
                    }
                    return(false);
                }
                else
                {
                    Action.Agent.Mobility.UnsetMoveTarget();
                }

                Action.TriggerAction(Target);
                return(true);
            }
            return(false);
        }