-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTask.cs
88 lines (75 loc) · 2.27 KB
/
Task.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Windows.Forms;
using System.Xml.Serialization;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
namespace TheraWii
{
[XmlInclude(typeof(DialogTask)), XmlInclude(typeof(RepeatTask)),
XmlInclude(typeof(Task2D)), XmlInclude(typeof(Task3D))]
public abstract class Task
{
//private string name;
protected bool conditionMet;
protected DScsv output;
public EndCondition endCondition;
public string Name;
public int totalReps, currRep;
[XmlIgnore]
public Vector3 Position = Vector3.Zero;
public abstract void Draw(GameTime gt);
public abstract List<WiiType> getRequiredDevices();
public Task returnNew()
{
if (this.GetType() == typeof(DialogTask))
return new DialogTask((DialogTask)this);
else if (this.GetType() == typeof(RepeatTask))
return new RepeatTask((RepeatTask)this);
else if (this.GetType() == typeof(Task2D))
return new Task2D((Task2D)this);
else if (this.GetType() == typeof(Task3D))
return new Task3D((Task3D)this);
else
return null;
}
public virtual void Initialize(
GraphicsDeviceManager g, ContentManager c, SpriteBatch sb,
int screenHeight, int screenWidth,
Session s, Vector3 position)
{
conditionMet = false;
endCondition.isNewExecution = true;
Position = position;
output = s.GetCSV();
output.startTask(this);
}
public virtual void Finish()
{
}
public virtual bool isComplete()
{
return conditionMet;
}
public virtual void Update(GameTime gt)
{
if (!conditionMet)
conditionMet = endCondition.isMet(gt, new Region(), new Vector3());
}
public override string ToString()
{
return Name;
}
public virtual TreeNode GetTreeNode()
{
TreeNode n = new TreeNode(this.ToString());
n.Tag = this;
return n;
}
public virtual Form GetTaskForm()
{
return new Form();
}
}
}