当前位置: 首页>>代码示例>>C#>>正文


C# GameStates类代码示例

本文整理汇总了C#中GameStates的典型用法代码示例。如果您正苦于以下问题:C# GameStates类的具体用法?C# GameStates怎么用?C# GameStates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GameStates类属于命名空间,在下文中一共展示了GameStates类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Win

 public void Win()
 {
     if(gameState == GameStates.Playing) {
         gameState = GameStates.Won;
         winScreen.SetActive(true);
     }
 }
开发者ID:Junuxx,项目名称:MiniLD-62,代码行数:7,代码来源:GameManager.cs

示例2: destroyGameState

    private void destroyGameState(GameStates pState)
    {
        switch (pState)
        {
            case GameStates.menu:
                {
                    if (_menu != null) { _menu.Destroy(); }
                    break;
                }
            case GameStates.level:
                {
                    //if (_level != null) { _level.Destroy(); }
                    break;
                }
            case GameStates.bossarena:
                {
                    if (_bossArena != null) { _bossArena.Destroy(); }
                    break;
                }
            case GameStates.nameinput:
                {
                    if (_nameinput != null) { _nameinput.Destroy(); }
                    break;
                }
            case GameStates.endscreen:
                {
                    if (_endscreen != null) { _endscreen.Destroy(); }
                    break;
                }

        }
    }
开发者ID:mbos14,项目名称:GTFO,代码行数:32,代码来源:MyGame.cs

示例3: EnterMenu

        public void EnterMenu(GameStates stateWhenEntering, GameStates menuTypeToEnter)
        {
            previousGameState = stateWhenEntering;
            currentSelectionIndex = 0;
            prevSelectionIndex = 0;
            menuType = menuTypeToEnter;

            if (menuType == GameStates.MainMenu)
            {
                Game.SoundManager.PlaySong("LOD", true);
                foreach (MenuEntry entry in MainMenuEntries.Keys)
                {
                    entry.SetUnselected();
                }
                MainMenuEntries.ElementAt(currentSelectionIndex).Key.SetSelected();
            }
            else if (menuType == GameStates.PAUSE)
            {
                foreach (MenuEntry entry in PauseMenuEntries.Keys)
                {
                    entry.SetUnselected();
                }
                PauseMenuEntries.ElementAt(currentSelectionIndex).Key.SetSelected();
            }
        }
开发者ID:skakri09,项目名称:LabyrinthExplorer-XNA-3D-game,代码行数:25,代码来源:Menu.cs

示例4: ChangeToState

 public static void ChangeToState(GameStates state)
 {
     switch (state)
     {
         case GameStates.MainMenuState:
             CurrentState = new MainMenuState(currentScreenSize);
             break;
         case GameStates.LevelOneState:
             CurrentState = new LevelOneState(content, currentScreenSize);
             break;
         case GameStates.LevelTwoState:
             CurrentState = new LevelTwoState(content, currentScreenSize);
             break;
         case GameStates.LevelThreeState:
             CurrentState = new LevelThreeState(content, currentScreenSize);
             break;
         case GameStates.FinalLevel:
             CurrentState = new FinalLevel(content, currentScreenSize);
             break;
         case GameStates.Quit:
             CurrentState = new QuitState(currentScreenSize);
             break;
         case GameStates.PickName:
             CurrentState = new PickNameState(currentScreenSize);
             break;
             case GameStates.HighScore:
             CurrentState = new HighScoreState(currentScreenSize);
             break;
     }
     if (UnSeriousEngine.isInitialized)
     {
         CurrentState.LoadContent(Content);
     }
 }
开发者ID:titanXL,项目名称:SoftwareUniversity,代码行数:34,代码来源:StateManager.cs

示例5: FirstEvent

 // Event
 public void FirstEvent()
 {
     eventManager.firstEvent -= FirstEvent;
     state = GameStates.Stop;
     Vector3 cameraPos = Camera.main.gameObject.transform.position;
     Instantiate (bossList[0], new Vector3(cameraPos.x, cameraPos.y + 12f, 0f), Quaternion.identity);
 }
开发者ID:BenjaminBoumendil,项目名称:SHMUP,代码行数:8,代码来源:GameManager.cs

示例6: inputHandler

 private void inputHandler()
 {
     if (Input.GetKeyDown("p")) {
         state = state == GameStates.Run ? GameStates.Pause : GameStates.Run;
         Time.timeScale = Time.timeScale == 0f ? 1f : 0f;
     }
 }
开发者ID:BenjaminBoumendil,项目名称:SHMUP,代码行数:7,代码来源:GameManager.cs

示例7: GameClass

        //  The GameClass constructor.  Here we create, but not show, the GameSettings form.
        // The
        public GameClass(MainClass mainClass, Control owner)
        {
            gameState = GameStates.Loading;
            this.owner = owner;
            this.mainClass = mainClass;
            splash = new SplashScreen(this);
            splash.ShowDialog();
            gameSettings = new SpaceWar.GameSettings(this);
            gameSettings.Location = new Point(owner.Bounds.Right,owner.Bounds.Top);
            gravity = gameSettings.Gravity;
            gameSpeed = gameSettings.GameSpeed;
            bounceBack = gameSettings.Bounce;
            inverseGravity = gameSettings.InverseGravity;
            blackHole = gameSettings.BlackHole;

            localDevice = new Microsoft.DirectX.DirectDraw.Device();
            localDevice.SetCooperativeLevel(owner, Microsoft.DirectX.DirectDraw.CooperativeLevelFlags.Normal);

            DXUtil.Timer(DirectXTimer.Start);

            SpaceWar.RotatableShape.CreateShapes();

            input = new InputClass(this.owner);

            soundHandler = new SoundHandler(this.owner);

            try {
                netPeer = new PlayClass(this);
            }
            catch(DirectXException e) {
                MessageBox.Show(owner,e.ToString());
            }
        }
开发者ID:timdetering,项目名称:BeginningNetGameProgramming,代码行数:35,代码来源:GameClass.cs

示例8: Update

 public void Update(GameTime gameTime, ref GameStates gameState)
 {
     if (_mControls.IsBackPressed(false))
         gameState = GameStates.Exit;
     if (_mControls.IsStartPressed(false) || _mControls.IsAPressed(false))
         gameState = GameStates.MainMenu;
 }
开发者ID:DizWARE,项目名称:Mr-Gravity,代码行数:7,代码来源:Title.cs

示例9: ReflexGameWindow

        public ReflexGameWindow(string userName, int initialGameTime)
        {
            InitializeComponent();
            SetMouseForm(gameWindow, CHART_WIDTH, CHART_HEIGHT, timeLabel);
            setTimeOutMethod(timedOut);
            setQuestionTime((double)initialGameTime);

            CoordsList = new List<TimePoint>();

            greenBrush = new SolidBrush(Color.Green);
            blueBrush = new SolidBrush(Color.Blue);
            redBrush = new SolidBrush(Color.Red);

            this.maxGameTime = INITIAL_GAME_TIME = initialGameTime;
            graphics = gameWindow.CreateGraphics();
            gameState = GameStates.OutOfGame;
            this.userName = userName;
            rnd = new Random();

            scoreLabel.Text = "";
            timeLabel.Text = "";

            stopRButton.Enabled = false;
            stopLButton.Enabled = false;
        }
开发者ID:kanti1992,项目名称:mousecode,代码行数:25,代码来源:ReflexGameWindow.cs

示例10: setGameState

 public void setGameState(GameStates pState)
 {
     if (pState == _state) return;
     destroyGameState(_state);
     _state = pState;
     newGameState(pState);
 }
开发者ID:mbos14,项目名称:GTFO,代码行数:7,代码来源:HeraGUN.cs

示例11: ChangeState

    public static void ChangeState(GameStates newState)
    {
        if (instance.state == newState)
            return;

        // Before change
        switch (instance.state) {
            case GameStates.Login:
                break;
            case GameStates.Playing:
                instance.highscoreCanvas.gameObject.SetActive(false);
                break;
            case GameStates.Paused:
                instance.pauseCanvas.gameObject.SetActive(false);
                break;
        }

        instance.state = newState;

        // After change
        switch (instance.state) {
            case GameStates.Login:
                break;
            case GameStates.Playing:
                instance.highscoreCanvas.gameObject.SetActive(true);
                break;
            case GameStates.Paused:
                instance.pauseCanvas.gameObject.SetActive(true);
                break;
        }
    }
开发者ID:brunovcosta,项目名称:AgarIME,代码行数:31,代码来源:GameManager.cs

示例12: StartGame

 public void StartGame()
 {
     currentGameState = GameStates.Play;
     gamesFirstTouch = false;
     //turns off all button menus
     menuManager.SwitchMenu (MenuManager.MenuTypes.None);
 }
开发者ID:sfraguela,项目名称:JesterJump,代码行数:7,代码来源:GameManager.cs

示例13: Restart

    public void Restart()
    {
        theGameState = GameStates.GS_USER_INPUT;

        //reset the target's height
        if (theTarget != null && theHill != null)
        {
            Vector3 targetNewPosistion = new Vector3(theHill.transform.position.x, theHill.transform.position.y, theHill.transform.position.z);
            float hillXRotRadians = -Mathf.Deg2Rad * theHill.transform.rotation.eulerAngles.x;
            float distUpHill = UnityEngine.Random.Range(-1.0f, 1.0f) * HILL_UNSCALED_HALF_WIDTH * theHill.transform.localScale.z;

            //use polar coordinates & the hill's angle to randomly select a distance up the hill for the target
            targetNewPosistion.x += UnityEngine.Random.Range(-HILL_HALF_WIDTH, HILL_HALF_WIDTH) / 2.0f;
            targetNewPosistion.y += distUpHill * Mathf.Sin(hillXRotRadians);
            targetNewPosistion.z += distUpHill * Mathf.Cos(hillXRotRadians);
            /*print("targetNewPosition = " + targetNewPosistion + ", distUpHill = " + distUpHill + " hillXRotRadians = " + hillXRotRadians +
                  "euler.x = " + theHill.transform.rotation.eulerAngles.x);*/
            theTarget.transform.Translate(targetNewPosistion - theTarget.transform.position);
        }

        //reset the ball
        if (theBall != null)
        {
            theBall.Restart();
        }

        //reset the ballista
        if (theBallista != null)
        {
            theBallista.Restart();
        }
    }
开发者ID:497273882,项目名称:UnityProjects,代码行数:32,代码来源:GameManager.cs

示例14: SwitchState

 public void SwitchState(GameStates newState)
 {
     if (_currentState == newState)
         return;
     
     //run code
 }
开发者ID:pepi55,项目名称:ProefProeve,代码行数:7,代码来源:StateControler.cs

示例15: SetGameState

 public void SetGameState(GameStates newState)
 {
     Debug.Log("Setting GameState :" + newState.ToString());
     if (newState == GameStates.GameOverLoss) {
         RestartGame();
     }
 }
开发者ID:ambitiousgame,项目名称:Ambitious-Game-Hour,代码行数:7,代码来源:Data.cs


注:本文中的GameStates类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。