Exemple #1
0
 public Task3D()
 {
     endCondition = new ButtonEndCondition();
     primaryInput = new InputBalanceBoard();
     region = new Region();
     inputHandling = InputHandling.Differential;
 }
Exemple #2
0
 public Region(Region r)
 {
     regionEnabled = r.regionEnabled;
     rParams = new SerializableDictionary<regPT, RegionParameter>();
     foreach (regPT rPT in r.rParams.Keys)
     {
         rParams.Add(rPT, new RegionParameter(r.rParams[rPT]));
     }
     Shape = r.Shape;
 }
Exemple #3
0
 public Task2D(Task2D tk)
 {
     Name = "copy of " + tk.Name;
     additionalInput = new List<InputDevice>(tk.additionalInput);
     endCondition = tk.endCondition.returnNew();
     primaryInput = tk.primaryInput.returnNew();
     regionEnabled = tk.regionEnabled;
     rand = new Random();
     region = new Region(tk.region);
 }
Exemple #4
0
 public Task2D()
 {
     additionalInput = new List<InputDevice>();
     endCondition = new ButtonEndCondition();
     primaryInput = new InputBalanceBoard();
     regionEnabled = false;
     rand = new Random();
     region = new Region();
     ((RegionParameter)region.rParams[regPT.Z]).pos = new float[2]{0,0};
     ((RegionParameter)region.rParams[regPT.Z]).size = new float[2]{0,0};
 }
Exemple #5
0
        public override bool isMet(GameTime gameTime, Region r, Vector3 pos)
        {
            // reset elapsedTime on new Execution
            if (isNewExecution)
            {
                elapsedTime = new TimeSpan();
                isNewExecution = false;
                inRegion = false;
            }
            // Update
            switch (Type)
            {
                case TimeLimitType.TimeInRegion:
                    if (r.isInRegion(pos))
                    {
                        elapsedTime += gameTime.ElapsedGameTime;
                        inRegion = true;
                    }
                    else
                    {
                        elapsedTime -= elapsedTime;
                        inRegion = false;
                    }
                    break;
                case TimeLimitType.TimeOutRegion:
                    if (r.isInRegion(pos))
                    {
                        elapsedTime -= elapsedTime;
                        inRegion = true;
                    }
                    else
                    {
                        elapsedTime += gameTime.ElapsedGameTime;
                        inRegion = false;
                    }
                    break;
                case TimeLimitType.TotalTime:
                default:
                    elapsedTime += gameTime.ElapsedGameTime;
                    break;
            }

            // Check
            return elapsedTime.TotalSeconds >= TimeLimit;
        }
Exemple #6
0
 public override bool isMet(GameTime gameTime, Region r, Vector3 pos)
 {
     throw new NotImplementedException();
 }
Exemple #7
0
 public abstract bool isMet(GameTime gameTime, Region r, Vector3 pos);
Exemple #8
0
        public override bool isMet(GameTime gameTime, Region r, Vector3 pos)
        {
            MouseState mouse = Mouse.GetState();
            WiimoteState remote = WiiUse.GetRemoteState();
            BalanceBoardState balance = WiiUse.GetBalanceBoardState();
            bool rv = false;

            switch (Button)
            {
                case Button.LeftMouse:
                    rv = mouse.LeftButton == ButtonState.Pressed
                        && lastMouse.LeftButton == ButtonState.Released;
                    break;
                case Button.RightMouse:
                    rv = mouse.RightButton == ButtonState.Pressed
                        && lastMouse.RightButton == ButtonState.Released;
                    break;
                case Button.A:
                    rv = remote.a == ButtonState.Pressed
                        && lastRemote.a == ButtonState.Released;
                    break;
                case Button.B:
                    rv = remote.b == ButtonState.Pressed
                        && lastRemote.b == ButtonState.Released;
                    break;
                case Button.Up:
                    rv = remote.dUp == ButtonState.Pressed
                        && lastRemote.dUp == ButtonState.Released;
                    break;
                case Button.Down:
                    rv = remote.dDown == ButtonState.Pressed
                        && lastRemote.dDown == ButtonState.Released;
                    break;
                case Button.Left:
                    rv = remote.dLeft == ButtonState.Pressed
                        && lastRemote.dLeft == ButtonState.Released;
                    break;
                case Button.Right:
                    rv = remote.dRight == ButtonState.Pressed
                        && lastRemote.dRight == ButtonState.Released;
                    break;
                case Button.One:
                    rv = remote.one == ButtonState.Pressed
                        && lastRemote.one == ButtonState.Released;
                    break;
                case Button.Two:
                    rv = remote.two == ButtonState.Pressed
                        && lastRemote.two == ButtonState.Released;
                    break;
                case Button.Home:
                    rv = remote.home == ButtonState.Pressed
                        && lastRemote.home == ButtonState.Released;
                    break;
                case Button.Plus:
                    rv = remote.plus == ButtonState.Pressed
                        && lastRemote.plus == ButtonState.Released;
                    break;
                case Button.Minus:
                    rv = remote.minus == ButtonState.Pressed
                        && lastRemote.minus == ButtonState.Released;
                    break;
                case Button.BalanceBoardButton:
                    rv = balance.button == ButtonState.Pressed
                        && lastBalance.button == ButtonState.Released;
                    break;
                default:
                    rv = false;
                    break;
            }
            lastMouse = mouse;
            lastRemote = remote;
            lastBalance = balance;

            return rv;
        }