public NumberSlot(EquationInput owner, int offsetX, int offsetY, bool reassignable) { Owner = owner; OffsetX = offsetX; OffsetY = offsetY; Size = new Point(44, 44); Reassignable = reassignable; CollisionType = "slot"; }
private void AddInput() { Input = new EquationInput((MainGame.Width / 2) - 337 / 2, MainGame.Height); var left = new Vector2(Input.X - 50, 250); var right = new Vector2(Input.X + 80, 250); Input.Actions.AddAction(new CallFunction(delegate() { PauseClocks(); }), true); Input.Actions.AddAction(new TweenPositionTo(Input, CurrentPlayer == PlayerOne ? left : right, 2f, Tweening.Back.EaseOut), true); Input.Actions.AddAction(new CallFunction(delegate() { ResumeCurrentClock(); }), true); Input.Actions.AddAction(new WaitForEquationInput(Input, EquationInputType.Equation), true); Input.Actions.AddAction(new CallFunction(delegate() { PauseClocks(); }), true); Input.Actions.AddAction(new CallFunction(delegate() { SwitchCurrentPlayer(); }), true); Input.Actions.AddAction(new TweenPositionTo(Input, CurrentPlayer == PlayerOne ? right : left, 2f, Tweening.Back.EaseOut), true); Input.Actions.AddAction(new CallFunction(delegate() { ResumeCurrentClock(); }), true); Input.Actions.AddAction(new WaitForEquationInput(Input, EquationInputType.Product), true); Input.Actions.AddAction(new CallFunction(delegate() { PauseClocks(); }), true); Input.Actions.AddAction(new EndEquationInput(Input), true); Input.Actions.AddAction(new CallFunction(delegate() { if (!Input.IsAnswerCorrect) { if (CurrentPlayer == PlayerOne) { PlayerOneClock.SubtractTime(); } else { PlayerTwoClock.SubtractTime(); } } RemoveEntity(Input); AddInput(); }), true); AddEntity(Input); Input.FirstEquationSlot.Player = Input.SecondEquationSlot.Player = CurrentPlayer == PlayerOne ? PlayerOne : PlayerTwo; Input.FirstProductSlot.Player = Input.SecondProductSlot.Player = CurrentPlayer == PlayerOne ? PlayerTwo : PlayerOne; }
private void AddRandomBalloons(EquationInput input) { var rand = new Random(); var ball1 = new Balloon(input.X, input.Y, rand.Next(0, 11)); var ball2 = new Balloon(input.X, input.Y, rand.Next(0, 11)); AddEntity(ball1); AddEntity(ball2); ball1.AttachTo(Input.FirstEquationSlot); Input.FirstEquationSlot.Balloon = ball1; ball1.BalloonBody.CollidesWith = Category.None; ball2.AttachTo(Input.SecondEquationSlot); Input.SecondEquationSlot.Balloon = ball2; ball2.BalloonBody.CollidesWith = Category.None; }
private void AddInput() { Input = new EquationInput((MainGame.Width / 2) - 337 / 2, MainGame.Height); //Input.CurrentPlayer = CurrentPlayer; var center = new Vector2((MainGame.Width / 2) - (337 / 2), 200); Input.Actions.AddAction(new CallFunction(delegate() { PauseClock(); }), true); Input.Actions.AddAction(new CallFunction(delegate() { ShuffleBalloons(); }), true); Input.Actions.AddAction(new TweenPositionTo(Input, center, 2f, Tweening.Back.EaseOut), true); Input.Actions.AddAction(new CallFunction(delegate() { ResumeCurrentClock(); }), true); Input.Actions.AddAction(new WaitForEquationInput(Input, EquationInputType.Product), true); Input.Actions.AddAction(new CallFunction(delegate() { PauseClock(); }), true); Input.Actions.AddAction(new EndEquationInput(Input), true); Input.Actions.AddAction(new CallFunction(delegate() { if (!Input.IsAnswerCorrect) { MainClock.SubtractTime(); } else { MainClock.AddTime(); Score.AddPoints(); } RemoveEntity(Input); AddInput(); }), true); AddEntity(Input); AddRandomBalloons(Input); Input.FirstEquationSlot.Player = Input.SecondEquationSlot.Player = null; Input.FirstProductSlot.Player = null; Input.SecondProductSlot.Player = null; }
public EndEquationInput(EquationInput input) { Input = input; }
private void AddBalloons(EquationInput input) { var rand = new Random(); var ball1 = new Balloon((int)input.X, (int)input.Y, 5); var ball2 = new Balloon((int)input.X, (int)input.Y, 6); AddEntity(ball1); AddEntity(ball2); ball1.AttachTo(Input.FirstEquationSlot); Input.FirstEquationSlot.Balloon = ball1; ball2.AttachTo(Input.SecondEquationSlot); Input.SecondEquationSlot.Balloon = ball2; }
public WaitForEquationInput(EquationInput input, EquationInputType type) { Input = input; Type = type; }
private void AddRandomBalloons(EquationInput input) { switch (input.CurrentOperator) { case Settings.type.Multiplication: AddBalloonsMultipliction(input); break; case Settings.type.Addition: AddBalloonsAddition(input); break; case Settings.type.Subtraction: AddBalloonsSubtraction(input); break; } //if ((input.CurrentOperator == Settings.type.Subtraction) && (ball1.Number < ball2.Number)) { // RemoveEntity(ball1); // RemoveEntity(ball2); // RemoveEntity(ball3); // RemoveEntity(ball4); // AddRandomBalloons(input); //} }
private void AddBalloonsSubtraction(EquationInput input) { var rand = new Random(); int Number1 = rand.Next(11, 100); int Number2 = rand.Next(10, Number1 - 1); var ball1 = new Balloon((int)input.X, (int)input.Y, GetIntArray(Number1)[0]); var ball2 = new Balloon((int)input.X, (int)input.Y, GetIntArray(Number2)[0]); var ball3 = new Balloon((int)input.X, (int)input.Y, GetIntArray(Number1)[1]); var ball4 = new Balloon((int)input.X, (int)input.Y, GetIntArray(Number2)[1]); AddEntity(ball1); AddEntity(ball2); AddEntity(ball3); AddEntity(ball4); ball1.AttachTo(Input.FirstEquationSlot); Input.FirstEquationSlot.Balloon = ball1; ball1.BalloonBody.CollidesWith = Category.None; ball2.AttachTo(Input.SecondEquationSlot); Input.SecondEquationSlot.Balloon = ball2; ball2.BalloonBody.CollidesWith = Category.None; ball3.AttachTo(Input.ThirdEquationSlot); Input.ThirdEquationSlot.Balloon = ball3; ball3.BalloonBody.CollidesWith = Category.None; ball4.AttachTo(Input.FourthEquationSlot); Input.FourthEquationSlot.Balloon = ball4; ball4.BalloonBody.CollidesWith = Category.None; }