private bool wholeBoardClick(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            switch (eventtype)
            {
            case TouchType.TouchUp:
                if (collide)
                {
                    if (State.ShowingTutorial > 2)
                    {
                        State.ShowingTutorial = 0;
                        return(false);
                    }
                }
                break;

            case TouchType.TouchDown:
                if (collide)
                {
                    if (State.ShowingTutorial == 1 || State.ShowingTutorial == 2)
                    {
                        State.ShowingTutorial++;
                        Client.PlaySoundEffect(Assets.Sounds.Click);

                        return(false);
                    }
                }
                break;
            }
            return(true);
        }
Exemplo n.º 2
0
        private bool numberSelectionDrag(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (State.BackDialogVisible)
            {
                return(true);
            }

            if (GameService.ClassicGameState.GameState == GameSelectionState.ChooseNumber)
            {
                switch (eventtype)
                {
                case TouchType.TouchUp:
                    State.NSDragMouseDownPosition = null;
                    break;

                case TouchType.TouchDown:
                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    State.SwipeDistance                 = 0;
                    State.NSDragMouseDownPosition       = new Point(x, y);
                    State.NSDragMouseDownStartingNumber = State.CurrentNumber;
                    break;

                case TouchType.TouchMove:
                    if (State.NSDragMouseDownPosition != null)
                    {
                        State.CurrentNumber = Math.Max(Math.Min(State.NSDragMouseDownStartingNumber - (y - State.NSDragMouseDownPosition.Y) / 50, 60), 1);
                    }
                    break;
                }
                return(false);
            }
            return(true);
        }
Exemplo n.º 3
0
        public bool numberOfPlayersClick(TouchType eventType, TouchRect touchBox, int x, int y, bool collide)
        {
            if (State.StartClicked)
            {
                return(false);
            }
            switch (eventType)
            {
            case TouchType.TouchDown:
                if (State.MenuAnimation.Completed)
                {
                    Client.PlaySoundEffect(Assets.Sounds.Click);

                    var selectedNumberOfPlayers = (int)touchBox.State;
                    if (selectedNumberOfPlayers == 1)
                    {
                        State.SelectedNumberOfPlayers = selectedNumberOfPlayers;
                    }
                    else
                    {
                        if (HasMultiplayer)
                        {
                            State.SelectedNumberOfPlayers = selectedNumberOfPlayers;
                        }
                        else
                        {
                            //                                Client.ClientSettings.PurchaseProduct(GameService.Products[0]);
                        }
                    }
                }
                break;
            }
            return(false);
        }
Exemplo n.º 4
0
        private bool startGame(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (State.ShowingTutorial != 0)
            {
                return(true);
            }
            switch (eventtype)
            {
            case TouchType.TouchDown:
                if (State.StartClicked)
                {
                    return(false);
                }
                Client.PlaySoundEffect(Assets.Sounds.Click);
                State.StartClicked = true;

                IImage logoImage    = Assets.Images.Layouts.PenguinLogo;
                IImage shuffleImage = Assets.Images.Layouts.ShuffleLogo;

                PenguinLogoAnimation = MotionManager.StartMotion(Positions.PenguinLogoLocation)
                                       .Motion(new AnimationMotion(Layout.Width + 1000, Positions.PenguinLogoLocation.Y, 1000, AnimationEasing.SineEaseIn))
                                       .Motion(new WaitMotion(5000))
                                       .OnRender((layer, posX, posY, animationIndex, percentDone) => { mainLayer.DrawImage(logoImage, posX, posY, true); })
                                       .OnComplete(() => { });

                ShuffleLogoAnimation = MotionManager.StartMotion(Positions.ShuffleLogoLocation)
                                       .Motion(new AnimationMotion(Layout.Width + 1000, Positions.ShuffleLogoLocation.Y, 1400, AnimationEasing.SineEaseIn))
                                       .Motion(new WaitMotion(5000))
                                       .OnRender((layer, posX, posY, animationIndex, percentDone) => { mainLayer.DrawImage(shuffleImage, posX, posY, true); })
                                       .OnComplete(() => { });
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
        private bool closeBox(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (eventtype == TouchType.TouchDown)
            {
                if (State.ShowingTutorial > 0)
                {
                    State.ShowingTutorial++;
                    Client.PlaySoundEffect(Assets.Sounds.Click);

                    if (State.ShowingTutorial > 2)
                    {
                        State.ShowingTutorial = 0;
                    }
                    return(false);
                }
                if (State.AboutState == AboutState.Opened)
                {
                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    State.AboutState = AboutState.Closing;
                    AboutCloseAnimation.Restart();
                    AboutCloseDialogAnimation.Restart();
                    return(false);
                }
                return(true);
            }
            return(true);
        }
Exemplo n.º 6
0
        public bool toggleOpening(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (State.StartClicked)
            {
                return(false);
            }
            if (eventtype == TouchType.TouchDown)
            {
                if (State.AboutState == AboutState.Opened)
                {
                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    State.AboutState = AboutState.Closing;
                    AboutCloseAnimation.Restart();
                    AboutCloseDialogAnimation.Restart();
                }
                else if (State.AboutState == AboutState.Closed)
                {
                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    State.AboutState = AboutState.Opening;
                    AboutOpenAnimation.Restart();
                    AboutOpenDialogAnimation.Restart();
                }

                return(true);
            }
            return(false);
        }
Exemplo n.º 7
0
        private bool wholeBoardClick(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            switch (eventtype)
            {
            case TouchType.TouchMove:
                if (State.BackDialogVisible)
                {
                    return(true);
                }
                if (State.NSDragMouseDownPosition != null)
                {
                    int i1 = Positions.NumberSelectionBoxPosition.Y - Positions.NumberSelectionBoxSize.Y / 2;

                    State.CurrentNumber = Math.Max(Math.Min(State.NSDragMouseDownStartingNumber - ((y - i1) - State.NSDragMouseDownPosition.Y) / 50, 60), 1);
                }
                break;

            case TouchType.TouchDown:
                if (State.BackDialogVisible)
                {
                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    State.BackDialogVisible = false;
                    return(true);
                }


                closeNumberSelect();
                break;
            }
            return(true);
        }
        public void Init()
        {
            TouchManager.ClearClickRect();
            TouchManager.ClearSwipeRect();

            for (int x = 0; x < BoardConstants.SquareWidth; x++)
            {
                for (int y = 0; y < BoardConstants.SquareHeight; y++)
                {
                    int x1        = x;
                    int y1        = y;
                    var touchRect = new TouchRect(x * BoardConstants.SquareSize + BoardConstants.SideOffset, y * BoardConstants.SquareSize + BoardConstants.TopOffset, BoardConstants.SquareSize, BoardConstants.SquareSize,
                                                  (type, box, touchX, touchY, collide) => squareTouch(x1, y1, type, box, touchX, touchY, collide));

                    Layout.LayoutView.TouchManager.PushClickRect(touchRect);
                }
            }
            Layout.LayoutView.TouchManager.PushSwipeRect(new TouchRect(0, 0, BoardConstants.TotalWidth, BoardConstants.TopAreaHeight, swipeMotion));


            Layout.LayoutView.TouchManager.PushClickRect(new TouchRect(Positions.UndoButtonRect, undoPress));
            Layout.LayoutView.TouchManager.PushClickRect(new TouchRect(Positions.PassButtonRect, passPress));

            Layout.LayoutView.TouchManager.PushClickRect(new TouchRect(0, 0, Layout.Width, Layout.Height, wholeBoardClick));

            startTurn(GameService.ClassicGameState.ChosenNumbers[GameService.ClassicGameState.ChosenNumbers.Count - 1]);
            foreach (var animatedCharacterSubLayout in CharacterAnimations)
            {
                animatedCharacterSubLayout.Value.InitLayoutView(TouchManager);
            }
        }
        private bool tapCard(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (eventtype == TouchType.TouchDown)
            {
                if (State.CardAnimationMotion != null)
                {
                    return(false);
                }

                Client.PlaySoundEffect(Assets.Sounds.Click);
                var    gc        = (Goal)touchbox.State;
                IImage goalImage = GoalPiece.GetGoalImage(gc);


                Goal[] goals = GameService.ClassicGameState.UnusedGoals;
                int    topRow = goals.Length / 2;
                int    bottomRow = goals.Length / 2 + goals.Length % 2;
                int    posx, posy;
                int    index = Array.IndexOf(goals, gc);

                int yAnimateOffset = 0;
                if (index < topRow)
                {
                    int centerOffset = (Positions.BottomCardAreaWidth / (topRow)) / 2;

                    posx           = ((Positions.BottomCardAreaWidth / topRow * (index))) + centerOffset;
                    posy           = (Positions.BottomCardSize / 2) - Positions.CardShadowHeight;
                    yAnimateOffset = 0;
                }
                else
                {
                    int centerOffset = (Positions.BottomCardAreaWidth / (bottomRow)) / 2;

                    posx           = ((Positions.BottomCardAreaWidth / bottomRow * (index - topRow))) + centerOffset;
                    posy           = Positions.BottomCardSize - 40 + Positions.BottomCardSize / 2 - Positions.CardShadowHeight;
                    yAnimateOffset = 300;
                }

                State.CurrentlySelectedGoal = gc;

                State.CardAnimationMotion = MotionManager.StartMotion(posx, posy, new AnimationMotion(Positions.Layout.Width / 2, posy - 850 - yAnimateOffset, 1500, AnimationEasing.BounceEaseIn))
                                            .Motion(new WaitMotion(1000))
                                            .Motion(new AnimationMotion(Positions.Layout.Width / 2, -3000, 1000, AnimationEasing.CubicEaseOut))
                                            .OnRender((layer, posX, posY, animationIndex, percentDone) => { MainLayer.DrawImage(goalImage, posX, posY, true); })
                                            .OnComplete(() =>
                {
                    gc.Used = true;

                    GameService.ClassicGameState.CurrentGoal = gc;
                    State.CardAnimationMotion = null;

                    GameService.ClassicGameState.GameState = GameSelectionState.SearchingBoard;
                    ScreenTransitioner.ChangeToBoardViewingScreen();
                });

                return(false);
            }
            return(true);
        }
        private bool selectCharacter(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (State.ShowingTutorial > 0)
            {
                return(true);
            }

            switch (eventtype)
            {
            case TouchType.TouchDown:


                foreach (Character chosenCharacter in GameService.ClassicGameState.Characters)
                {
                    chosenCharacter.Selected = false;
                }


                var currentCharacter = ((Character)touchbox.State);
                if (currentCharacter.Playing)
                {
                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    State.CurrentCharacter = null;
                    GameService.ClassicGameState.GameState = GameSelectionState.PlayerChoose;
                    return(false);
                }
                switch (GameService.ClassicGameState.GameState)
                {
                case GameSelectionState.PlayerChoose:

                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    State.CurrentCharacter   = currentCharacter;
                    State.CurrentCharacter.X = -1;
                    GameService.ClassicGameState.GameState = GameSelectionState.PlayerPlace;
                    State.CurrentCharacter.Selected        = true;
                    break;

                case GameSelectionState.PlayerPlace:
                    Client.PlaySoundEffect(Assets.Sounds.Click);

                    State.CurrentCharacter.Selected = false;
                    if (State.CurrentCharacter == touchbox.State)
                    {
                        GameService.ClassicGameState.GameState = GameSelectionState.PlayerChoose;
                        State.CurrentCharacter.Selected        = false;
                        State.CurrentCharacter = null;
                        return(false);
                    }
                    State.CurrentCharacter          = currentCharacter;
                    State.CurrentCharacter.Selected = true;
                    State.CurrentCharacter.X        = -1;
                    break;
                }


                break;
            }
            return(false);
        }
        private bool touchBottom(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (State.ShowingTutorial > 0)
            {
                return(true);
            }

            return(true);
        }
Exemplo n.º 12
0
 private bool soundToggleTrigger(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
 {
     if (eventtype == TouchType.TouchDown)
     {
         client.SoundEnabled = !client.SoundEnabled;
         client.PlaySoundEffect(Assets.Sounds.Click);
         return(false);
     }
     return(true);
 }
        private bool squareTouch(int boxX, int boxY, TouchType eventtype, TouchRect touchbox, int touchX, int touchY, bool collide)
        {
            switch (eventtype)
            {
            case TouchType.TouchDown:


                break;
            }
            return(true);
        }
        public void Init()
        {
            State     = new BoardSelectionAreaLayoutState(Layout);
            Positions = new BoardSelectionAreaLayoutStatePositions(Layout);

            TouchManager.ClearClickRect();
            TouchManager.ClearSwipeRect();

            Layout.LayoutView.TouchManager.PushClickRect(new TouchRect(0, 0, Layout.Width, Layout.Height, wholeBoardClick));

            for (int x = 0; x < BoardConstants.SquareWidth; x++)
            {
                for (int y = 0; y < BoardConstants.SquareHeight; y++)
                {
                    int x1        = x;
                    int y1        = y;
                    var touchRect = new TouchRect(x * BoardConstants.SquareSize + BoardConstants.SideOffset, y * BoardConstants.SquareSize + BoardConstants.TopOffset, BoardConstants.SquareSize, BoardConstants.SquareSize,
                                                  (type, box, touchX, touchY, collide) => squareTouch(x1, y1, type, box, touchX, touchY, collide));
                    Layout.LayoutView.TouchManager.PushClickRect(touchRect);
                }
            }

            Layout.LayoutView.TouchManager.PushClickRect(new TouchRect(0, BoardConstants.TopAreaHeight, BoardConstants.TotalWidth, Layout.Height - BoardConstants.TopAreaHeight, touchBottom));


            int charWidth  = 210;
            int charHeight = 200;

            for (int index = 0; index < Positions.CharacterPositions.Length; index++)
            {
                Point characterPosition = Positions.CharacterPositions[index];
                TouchManager.PushClickRect(new TouchRect(
                                               characterPosition.X - charWidth / 2 + 0,
                                               characterPosition.Y - charHeight / 2 + (BoardConstants.TopAreaHeight),
                                               charWidth,
                                               charHeight,
                                               selectCharacter,
                                               state: GameService.ClassicGameState.Characters[index]));
            }


            foreach (var animatedCharacterSubLayout in CharacterAnimations)
            {
                animatedCharacterSubLayout.Value.InitLayoutView(TouchManager);
            }


            if (!Client.UserPreferences.GetValueOrDefault("HasSeenTutorial", false))
            {
                Client.UserPreferences.AddOrUpdateValue("HasSeenTutorial", true);
                State.ShowingTutorial = 1;
            }
        }
Exemplo n.º 15
0
 private bool aboutRateTouch(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
 {
     if (State.AboutState != AboutState.Opened)
     {
         return(true);
     }
     if (eventtype == TouchType.TouchDown)
     {
         Client.PlaySoundEffect(Assets.Sounds.Click);
         Client.ClientSettings.OpenAppStore();
         return(false);
     }
     return(true);
 }
Exemplo n.º 16
0
 private bool tutorialTrigger(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
 {
     if (eventtype == TouchType.TouchDown)
     {
         if (State.StartClicked || !PlayButtonAnimation.Completed)
         {
             return(false);
         }
         Client.PlaySoundEffect(Assets.Sounds.Click);
         State.ShowingTutorial = 1;
         return(false);
     }
     return(true);
 }
Exemplo n.º 17
0
        private bool backClick(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (eventtype == TouchType.TouchDown)
            {
                if (State.CurrentTick != null)
                {
                    State.CurrentTick.Stop();
                }

                Client.PlaySoundEffect(Assets.Sounds.Click);
                State.BackDialogVisible = true;
            }
            return(false);
        }
Exemplo n.º 18
0
 private bool changeModeClick(TouchType eventType, TouchRect touchbox, int x, int y, bool collide)
 {
     switch (eventType)
     {
     case TouchType.TouchDown:
         if (State.MenuAnimation.Completed)
         {
             Client.PlaySoundEffect(Assets.Sounds.Click);
             State.SelectedMode = (State.SelectedMode == GameMode.Classic) ? GameMode.Puzzle : GameMode.Classic;
         }
         break;
     }
     return(false);
 }
Exemplo n.º 19
0
 private bool aboutContactTouch(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
 {
     if (State.AboutState != AboutState.Opened)
     {
         return(true);
     }
     if (eventtype == TouchType.TouchDown)
     {
         Client.PlaySoundEffect(Assets.Sounds.Click);
         Client.ClientSettings.SendEmail(BoardConstants.EmailAddress, BoardConstants.EmailSubject, BoardConstants.EmailMessage);
         return(false);
     }
     return(true);
 }
 private bool wholeBoardClick(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
 {
     if (eventtype == TouchType.TouchDown)
     {
         if (State.Congrats && State.CardAnimationMotion.Completed)
         {
             Client.PlaySoundEffect(Assets.Sounds.Click);
             GameService.ClassicGameState.CharacterWon(State.CurrentChosenNumber.Character);
             ScreenTransitioner.ChangeToBoardCardSelectionScreen();
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 21
0
 private bool backContinue(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
 {
     if (State.BackDialogVisible)
     {
         switch (eventtype)
         {
         case TouchType.TouchDown:
             Client.PlaySoundEffect(Assets.Sounds.Click);
             ScreenTransitioner.ChangeToLanding();
             break;
         }
         return(false);
     }
     return(true);
 }
Exemplo n.º 22
0
        private bool numberSelectionSelect(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (State.BackDialogVisible)
            {
                return(true);
            }

            if (GameService.ClassicGameState.GameState == GameSelectionState.ChooseNumber)
            {
                switch (eventtype)
                {
                case TouchType.TouchDown:
                    Client.PlaySoundEffect(Assets.Sounds.Click);
                    if (GameService.ClassicGameState.TimeStarted == 0)
                    {
                        GameService.ClassicGameState.TimeStarted = DateTime.Now.Ticks;
                    }
                    else
                    {
                        State.TimePaused += DateTime.Now.Ticks - State.TimePausedStart;
                    }

                    GameService.ClassicGameState.GameState = GameSelectionState.TimerStarted;
                    State.CurrentTick = Client.PlaySoundEffect(Assets.Sounds.TimeTick, true);
                    State.TotalChosens++;
                    State.CurrentCharacter.Selected = false;
                    foreach (ChosenNumber chosenNumber in GameService.ClassicGameState.ChosenNumbers)
                    {
                        if (chosenNumber.Character == State.CurrentCharacter)
                        {
                            chosenNumber.Number        = State.CurrentNumber;
                            chosenNumber.OrderChosenIn = State.TotalChosens;
                            resetNumberSelect();
                            return(false);
                        }
                    }
                    GameService.ClassicGameState.ChosenNumbers.Add(new ChosenNumber
                    {
                        Number        = State.CurrentNumber,
                        Character     = State.CurrentCharacter,
                        OrderChosenIn = State.TotalChosens
                    });
                    resetNumberSelect();
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 23
0
 private bool backClick(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
 {
     if (State.StartClicked)
     {
         return(false);
     }
     if (eventtype == TouchType.TouchDown)
     {
         if (State.MenuAnimation.Completed)
         {
             Client.PlaySoundEffect(Assets.Sounds.Click);
             GameService.CloudSubLayout.SlideLeft();
             State.ScreenManager.ChangeToLanding();
         }
     }
     return(false);
 }
 private bool wholeBoardTouch(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
 {
     if (eventtype == TouchType.TouchDown)
     {
         if (GameService.ClassicGameState.UnusedGoals.Length == 0)
         {
             var gamesCompleted = Client.UserPreferences.GetValueOrDefault("GamesCompleted", 0) + 1;
             if (gamesCompleted == 3)
             {
                 Client.UserPreferences.AddOrUpdateValue("GamesCompleted", gamesCompleted);
                 Client.ClientSettings.RateApp();
                 Client.PlaySoundEffect(Assets.Sounds.Click);
                 ScreenTransitioner.ChangeToLanding();
             }
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 25
0
 private bool backCancel(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
 {
     if (State.BackDialogVisible)
     {
         switch (eventtype)
         {
         case TouchType.TouchDown:
             Client.PlaySoundEffect(Assets.Sounds.Click);
             State.BackDialogVisible = false;
             if (GameService.ClassicGameState.GameState == GameSelectionState.TimerStarted)
             {
                 State.CurrentTick = Client.PlaySoundEffect(Assets.Sounds.TimeTick, true);
             }
             break;
         }
         return(false);
     }
     return(true);
 }
Exemplo n.º 26
0
        private bool selectCharacter(TouchType eventtype, TouchRect touchbox, int x, int y, bool collide)
        {
            if (State.BackDialogVisible)
            {
                return(true);
            }
            switch (eventtype)
            {
            case TouchType.TouchUp:
                if (!collide)
                {
                    return(false);
                }
                Client.PlaySoundEffect(Assets.Sounds.Click);

                if (closeNumberSelect())
                {
                    return(false);
                }

                switch (GameService.ClassicGameState.GameState)
                {
                case GameSelectionState.SearchingBoard:
                case GameSelectionState.TimerStarted:
                    var currentCharacter = ((Character)touchbox.State);
                    if (currentCharacter.Playing)
                    {
                        State.CurrentNumber    = 15;
                        State.CurrentCharacter = currentCharacter;
                        GameService.ClassicGameState.GameState = GameSelectionState.ChooseNumber;
                        State.CurrentCharacter.Selected        = true;
                        State.TimePausedStart = DateTime.Now.Ticks;
                        if (State.CurrentTick != null)
                        {
                            State.CurrentTick.Stop();
                        }
                    }
                    break;
                }
                return(false);
            }
            return(true);
        }
Exemplo n.º 27
0
 private bool wholeBoardSwipe(TouchRect touchbox, int startx, int starty, Point direction, double distance)
 {
     if (State.BackDialogVisible)
     {
         return(true);
     }
     if (GameService.ClassicGameState.GameState == GameSelectionState.ChooseNumber)
     {
         State.SwipeDistance = direction.Y;
         if (State.SwipeDistance > 0)
         {
             State.SwipeAcceleration = -10;
         }
         else
         {
             State.SwipeAcceleration = 10;
         }
     }
     return(false);
 }
Exemplo n.º 28
0
        public bool ShootBall(TouchType eventType, TouchRect touchBox, int x, int y, bool collide)
        {
            switch (eventType)
            {
            case TouchType.TouchUp:
                if (collide)
                {
                    CannonPlane.ShootBall();
                }
                break;

            case TouchType.TouchDown:
            case TouchType.TouchMove:
                if (collide)
                {
                    return(true);
                }
                break;
            }
            return(false);
        }
Exemplo n.º 29
0
        public bool RotateClick(TouchType eventType, TouchRect touchBox, int x, int y, bool collide)
        {
            switch (eventType)
            {
            case TouchType.TouchUp:
                MovingCannon = false;
                break;

            case TouchType.TouchDown:
                MovingCannon = true;
                break;

            case TouchType.TouchMove:
                if (MovingCannon)
                {
                    var angle = (int)((Math.Atan2(y - this.GameBoard.GameModel.CannonLocation.Y, x - this.GameBoard.GameModel.CannonLocation.X) * 180 / Math.PI) - 90);
                    this.RotateCannon(angle);
                }
                break;
            }
            return(false);
        }
Exemplo n.º 30
0
 private bool startGameClick(TouchType eventType, TouchRect touchbox, int x, int y, bool collide)
 {
     if (State.StartClicked)
     {
         return(false);
     }
     switch (eventType)
     {
     case TouchType.TouchDown:
         if (State.MenuAnimation.Completed)
         {
             Client.PlaySoundEffect(Assets.Sounds.Click);
             State.StartClicked = true;
             State.MenuAnimation.Reverse();
             State.StartGameAnimation.Reverse();
             State.MenuAnimation.Restart();
             State.StartGameAnimation.Restart();
         }
         break;
     }
     return(false);
 }