示例#1
0
        public Task(User user, string title)
        {
            User       = user;
            Title      = title;
            CreateDate = DateTime.Now;

            TaskScope.ValidTaskTitle(Title);
        }
示例#2
0
 public WalkTask(string name, TaskScope scope, Vector3 position, float timeLimit, float priority, bool isinterruptible, int urgencyLevel, Func <bool> onDoneFunction)
 {
     this.urgencyLevel    = urgencyLevel;
     this.taskName        = name;
     this.taskScope       = scope;
     this.target          = position;
     this.timeLimit       = timeLimit;
     this.priority        = priority;
     this.isinterruptible = isinterruptible;
     this.onDoneFunction  = onDoneFunction;
 }
示例#3
0
 public TaskBase(string name, TaskScope scope, Transform transform, float timeLim, float prio, float workTime, bool isinterruptible, int urgency, Func <bool> onDoneFunction)
 {
     this.UrgencyLevel     = urgency;
     this.taskName         = name;
     this.taskScope        = scope;
     this.interactionPoint = transform;
     this.timeLimit        = timeLim;
     this.timeLimitTimer   = timeLimit;
     this.priority         = prio;
     this.workTime         = workTime;
     this.isinterruptible  = isinterruptible;
     this.onDoneFunction   = onDoneFunction;
 }
示例#4
0
 public WanderTask(string name, TaskScope scope, Vector3 position, Func <bool> isTaskStillValidFunction, float timeLimit, float priority, bool isinterruptible, int urgencyLevel, float waitAroundTime)
 {
     this.workTime                 = waitAroundTime;
     this.urgencyLevel             = urgencyLevel;
     this.taskName                 = name;
     this.taskScope                = scope;
     this.target                   = position;
     this.timeLimit                = timeLimit;
     this.priority                 = priority;
     this.isinterruptible          = isinterruptible;
     this.workTimer                = this.workTime;
     this.isTaskStillValidFunction = isTaskStillValidFunction;
 }
        public List <Word> GetTask(TaskScope scope)
        {
            var result = new List <Word>(25);
            int rem    = 0;

            for (int i = 0; i <= 5; ++i)
            {
                List <Word> list = db.Words
                                   .Where(x => x.Points == i && (scope == TaskScope.All || (x.IsLearned == (scope == TaskScope.Learned))))
                                   .OrderBy(w => w.UpdatedAt)
                                   .Take(scheme[i] + rem)
                                   .ToList();
                rem += scheme[i] - list.Count();
                foreach (Word w in list)
                {
                    result.Add(w);
                }
            }
            return(result);
        }
示例#6
0
 public WalkTask(string name, TaskScope scope, Vector3 position, float timeLim, float priority, bool isinterruptible, int urgencyLevel, Func <bool> onDoneFunction, eAnimationType type, List <TaskBase> followUpTasks) :
     this(name, scope, position, timeLim, priority, isinterruptible, urgencyLevel, onDoneFunction, type)
 {
     this.followUpTasks = followUpTasks;
 }
示例#7
0
 public WalkTask(string name, TaskScope scope, Vector3 position, float timeLim, float priority, bool isinterruptible, int urgencyLevel, Func <bool> onDoneFunction, eAnimationType type) :
     this(name, scope, position, timeLim, priority, isinterruptible, urgencyLevel, onDoneFunction)
 {
     this.workAnimationType = type;
 }
示例#8
0
 public TaskBase(string name, TaskScope scope, Transform transform, float timeLim, float prio, float workTime, bool isinterruptible, int urgency, Func <bool> OnDoneFunction, eAnimationType type, InteractableObject interObject, List <TaskBase> followUpTasks) :
     this(name, scope, transform, timeLim, prio, workTime, isinterruptible, urgency, OnDoneFunction, type, interObject)
 {
     this.followUpTasks = followUpTasks;
 }
示例#9
0
 public TaskBase(string name, TaskScope scope, Transform transform, float timeLim, float prio, float workTime, bool isinterruptible, int urgency, Func <bool> OnDoneFunction, eAnimationType type) :
     this(name, scope, transform, timeLim, prio, workTime, isinterruptible, urgency, OnDoneFunction)
 {
     this.workAnimationType = type;
 }
 public ActionResult LoadWords(TaskScope scope = TaskScope.All) => Json(ws.GetTask(scope));
示例#11
0
 public WanderTask(string name, TaskScope scope, Vector3 position, Func <bool> isTaskStillValidFunction, float timeLim, float priority, bool isinterruptible, int urgencyLevel, float waitAroundTime, eAnimationType type, Func <bool> onWorkDoneFunction) :
     this(name, scope, position, isTaskStillValidFunction, timeLim, priority, isinterruptible, urgencyLevel, waitAroundTime)
 {
     this.workAnimationType  = type;
     this.onWorkDonefunction = onWorkDoneFunction;
 }
示例#12
0
 public WanderTask(string name, TaskScope scope, Vector3 position, Func <bool> isTaskStillValidFunction, float timeLim, float priority, bool isinterruptible, int urgencyLevel, float waitAroundTime, eAnimationType type, List <TaskBase> followUpTasks) :
     this(name, scope, position, isTaskStillValidFunction, timeLim, priority, isinterruptible, urgencyLevel, waitAroundTime, type)
 {
     this.followUpTasks = followUpTasks;
 }
示例#13
0
        public IScope ResolveScope(TaskScope taskScope = TaskScope.None, IScope localScope = null)
        {
            if (taskScope == TaskScope.None)
            {
                taskScope = this.TaskScope;
            }
            if (TaskScope == TaskScope.Environment)
            {
                throw new Exception("environment level is not resolveable to IScope");
            }
            if (taskScope == TaskScope.Project)
            {
                taskScope = TaskScope.Global; //for now Projects share same scope by design
            }
            if (taskScope == TaskScope.Parent)
            {
                if (null == Parent)
                {
                    taskScope = TaskScope.Global;
                }
                else
                {
                    var taskbase = Parent as TaskBase;
                    if (null == taskbase)
                    {
                        return((localScope ?? CurrentScope).GetParent());
                    }
                    return(taskbase.ResolveScope(TaskScope.Local));
                }
            }
            if (taskScope == TaskScope.Target)
            {
                if (this is CompoundTask && null == Parent)
                {
                    taskScope = TaskScope.Local;
                }
                else if (null == Parent)
                {
                    throw new Exception("cannot find target scope - invalid task structure");
                }
                else
                {
                    var target = Parent as TaskBase;
                    while (true)
                    {
                        if (null == target)
                        {
                            throw new Exception("cannot find target scope - invalid task structure");
                        }
                        if (target is CompoundTask && null == target.Parent)
                        {
                            return(target.ResolveScope(TaskScope.Local));
                        }
                        target = target.Parent as TaskBase;
                    }
                }
            }
            if (taskScope == TaskScope.Global)
            {
                return(this.Environment.Globals);
            }

            if (TaskScope == TaskScope.Local)
            {
                return(localScope ?? CurrentScope);
            }
            throw new Exception("invalid resolve scope request");
        }