AnimatePos() public method

Annimates the given model to the given position(x,y)
public AnimatePos ( ImageModel model, float toX, float toY, float timeInMs, bool loop = false ) : void
model SmashBros.Models.ImageModel
toX float
toY float
timeInMs float
loop bool
return void
コード例 #1
0
ファイル: MenuController.cs プロジェクト: Grutn/TDT4240-X2
        /// <summary>
        /// Show the character at bottom of screen when cursor hovers a characterThumb
        /// </summary>
        private void hoverCharacter(int playerIndex, int characterIndex)
        {
            //Get the character model
            CharacterStats chModel = characterModels[characterIndex];

            //Get character pose by using index
            ImageController img = characterImages[characterIndex];

            //Checks if player already has an entry for hovered character
            //Removes the hovered character
            if (characterHover.ContainsKey(playerIndex))
            {
                img.RemovePosition(characterHover[playerIndex]);
            }
            //If not hovered character add playerIndex to dictionary
            else
            {
                characterHover.Add(playerIndex, null);
            }

            ImageModel model = img.AddPosition(playerIndex * 260, 720, playerIndex);

            model.Id = characterIndex;
            img.AnimatePos(model, playerIndex * 260, 450, 300);
            characterHover[playerIndex] = model;

            //characterThumbs[index].Scale = 1.05f;
            characterThumbs[characterIndex].AnimateScale(1.1f, 500);
            characterThumbs[characterIndex].GetAt(0).CurrentRotation = 0.05f;

            img.IsVisible = true;
        }
コード例 #2
0
        /// <summary>
        /// Updates the menu according to which stat it is in
        /// </summary>
        private void UpdateAccordingToState()
        {
            //Only run if bt is loaded
            if (bg != null)
            {
                Category cursorCategory = Category.Cat5;
                int      y = -100;
                switch (state)
                {
                case PopupState.Removed:
                    y = -700;
                    break;

                case PopupState.Colapsed:
                    y = -610;
                    break;

                case PopupState.GamePause:
                    break;

                case PopupState.Options:
                    break;

                case PopupState.Help:
                    break;
                }

                //If y == -100  then we know the menubox is open
                if (y == -100)
                {
                    cursorCategory = Category.Cat6;
                    //Adds back button listener on gamepad
                    foreach (var pad in GamePadControllers)
                    {
                        pad.OnBackPress       += closeMenuBox;
                        pad.OnSuperKeyPressed += closeMenuBox;
                        pad.OnStartPress      += closeMenuBox;
                    }
                }
                else
                {
                    menuView.DisposeEntries();
                    foreach (var pad in GamePadControllers)
                    {
                        pad.OnBackPress       -= closeMenuBox;
                        pad.OnSuperKeyPressed -= closeMenuBox;
                        pad.OnStartPress      -= closeMenuBox;
                    }

                    RemoveView(menuView);
                }

                bg.IsVisible = true;
                bg.AnimatePos(175, y, 500, false);
                Screen.cursorsController.SetCursorCollisionCategory(cursorCategory);
            }
        }
コード例 #3
0
ファイル: MenuController.cs プロジェクト: Grutn/TDT4240-X2
        public override void OnNext(GameStateManager value)
        {
            ImageController animateIn = null, animateOut = null;

            switch (value.PreviousState)
            {
            case GameState.StartScreen:
                if (value.CurrentState != GameState.StartScreen)
                {
                    animateOut = startScreen;
                    RemoveView(tipsText);
                }
                break;

            case GameState.CharacterMenu:
                CharacterSelectionVisible = false;
                break;

            case GameState.MapsMenu:
                MapSelectionVisible = false;
                break;

            case GameState.GameOver:
                GameStatsVisible      = false;
                continueText.Position = new Vector2(250, 320);
                foreach (var pad in GamePadControllers)
                {
                    pad.PlayerModel.SelectedCharacter = null;
                }
                break;
            }

            switch (value.CurrentState)
            {
            case GameState.StartScreen:
                startScreen.IsVisible = true;
                animateOut            = selectionScreen;
                animateIn             = startScreen;
                AddView(tipsText);
                break;

            case GameState.CharacterMenu:
                selectionScreen.IsVisible = true;
                if (value.PreviousState != GameState.MapsMenu)
                {
                    animateIn = selectionScreen;
                }
                //Loads the sounds for the menu
                CharacterSelectionVisible = true;

                Screen.soundController.PlaySound("Menu/chooseCharacter");
                break;

            case GameState.MapsMenu:
                selectionScreen.IsVisible = true;
                //if selection screen not has position
                //then the gameplay has exited to mapselection
                if (selectionScreen.GetAt(0) == null)
                {
                    animateIn = selectionScreen;
                }
                MapSelectionVisible = true;
                break;

            case GameState.GamePlay:
                AddController(new GamePlayController(Screen, selectedMap));
                DisposeController(this);

                break;

            case GameState.GamePause:
                break;

            case GameState.GameOver:
                selectionScreen.IsVisible = true;
                animateIn        = selectionScreen;
                GameStatsVisible = true;
                Screen.popupMenuController.Disabled = false;
                break;
            }

            if (animateIn != null)
            {
                animateIn.Layer = 2;
                animateIn.SetPosition(-1280, 0);
                animateIn.AnimatePos(0, 0, 600, false);
            }
            if (animateOut != null)
            {
                animateOut.Layer = 1;
                animateOut.SetPosition(0, 0);
                animateOut.AnimatePos(1280, 0, 600, false);
            }
        }