Commit 85c0c3af authored by Martin LOISEAU's avatar Martin LOISEAU 🎄
Browse files

Add more action classes

parent a2c2c8d0
package com.example.qrquest.actions;
import com.example.qrquest.MainActivity;
public abstract class Action {
MainActivity mainActivity;
public Action(MainActivity mainActivity)
{
this.mainActivity = mainActivity;
}
public void Do()
{
throw new Error("Do() Method from action was not overriden");
......
package com.example.qrquest.actions;
import com.example.qrquest.MainActivity;
import com.example.qrquest.atom.Atom;
public class AddAtom extends Action {
private Atom atom;
public AddAtom(MainActivity mainActivity, Atom atom) {
super(mainActivity);
this.atom = atom;
}
public void Do()
{
mainActivity.Atoms.add((atom));
}
}
package com.example.qrquest.actions;
import com.example.qrquest.MainActivity;
import com.example.qrquest.node.Node;
public class AddNode extends Action {
private Node node;
public AddNode(MainActivity mainActivity, Node node) {
super(mainActivity);
this.node = node;
}
public void Do()
{
mainActivity.OpenNodes.add(node);
}
}
package com.example.qrquest.actions;
import android.speech.tts.TextToSpeech;
import com.example.qrquest.MainActivity;
public class TTSReading extends Action {
TextToSpeech tts;
private String TextToRead;
public TTSReading(String TextToRead)
public TTSReading(MainActivity mainActivity, String TextToRead)
{
super(mainActivity);
this.TextToRead = TextToRead;
}
......
package com.example.qrquest.atom;
public class SpeechAtom extends Atom {
}
......@@ -14,6 +14,12 @@ public class Node {
public List<Atom> Conditions;
public int ID;
public Node(List<Action> Actions, List<Atom> Conditions)
{
this.Actions = Actions;
this.Conditions = Conditions;
}
public boolean CheckConditions(List<Atom> AvailableAtoms)
{
List<Atom> UnresolvedConditions = Conditions; // will be empty at the end if every requirement is met
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment