/* Condition * * Authors: Shawn Chen * Copyright Matthew Belmonte 2007 */ using System; using System.Collections.Generic; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; namespace tAC_Engine { class Condition { /// /// Purpose: Condition acts as the precursor to Events, telling them when to run /// Called by: EventManager /// // Variables private bool complete; // Whether the condition has been fullfilled private string name; // Name the condition is to be referred by private string type; // Condition type (defaults to never) private Object[] data; // Values the condition will check against // Variable helper functions public bool Complete { set { complete = value; } get { return complete; } } public string Name { set { name = value; } get { return name; } } public string Type { set { type = value; } get { return type; } } public Object[] Data { set { data = value; } get { return data; } } // Constructors will do most of the work here public Condition():this("", "never", false) {} // Separate Single input conditions public Condition(string inName, string inType, Object input1) { complete = false; name = inName; type = inType; data = new Object[1]; data[0] = input1; } // Check if complete public void Check(int eTime) { // Exception catcher here // goes through each possible data condition if (type == "time") { if (eTime > (int)data[0]) { complete = true; } } if (type == "key") { //if (InputState.IsKeyDown((Keys)data[0])) // ; } else { // Default to "never" type } } } }