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


C# IGameState.Enter方法代码示例

本文整理汇总了C#中IGameState.Enter方法的典型用法代码示例。如果您正苦于以下问题:C# IGameState.Enter方法的具体用法?C# IGameState.Enter怎么用?C# IGameState.Enter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGameState的用法示例。


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

示例1: Start

 public void Start(Game game)
 {
     this.game = game;
     FirstTurn firstturn = new FirstTurn();
     this.NewState = firstturn;
     NewState.Enter(this);
 }
开发者ID:roric32,项目名称:inferno,代码行数:7,代码来源:GameState.cs

示例2: ChangeState

        /// <summary>
        /// Changes the current state of this FSM to a new state
        /// </summary>
        /// <param name="newState">New desired state</param>
        public void ChangeState(IGameState newState)
        {
            if (currentState != null)
            {
                currentState.Exit();
            }

            currentState = newState;

            if (newState != null)
            {
                currentState.Enter();
            }
        }
开发者ID:Oliverreason,项目名称:xnafpsframework,代码行数:18,代码来源:StateMachine.cs

示例3: Update

    void Update()
    {
        if (_currentGameState == null) return;

        if(_currentGameState.NextState != null)
        {
            var t = _currentGameState == _pauseState ? _currentGameState.NextState.CurrentStateTime : 0;

            var nextState = _currentGameState.NextState;
            _currentGameState.Exit();
            _currentGameState = nextState;
            _currentGameState.Enter();

            _currentGameState.CurrentStateTime = t;
        }

        _currentGameState.Update();
        _camEffects.RelativeSpeed = RelativeSpeed;

        var treshold = _camController.RelativeBounds.y - 5;

        for (int i = Spawner.LiveObjects.Count-1; i >= 0; i--)
        {
            if(Spawner.LiveObjects[i].transform.position.y < treshold)
                Spawner.LiveObjects[i].Release();
        }

        float jamStr = 0;

        for (int i = _jammers.Count - 1; i >= 0; i--)
        {
            if (_jammers[i].transform.position.y < treshold)
            {
                _jammers[i].Release();
                continue;
            }

            var d = Mathf.Max(3, Vector3.Distance(Player.transform.position, _jammers[i].transform.position));
            jamStr += Mathf.Clamp(6f / d, 0, 2);
        }

        _camEffects.JAMMERIntensity = jamStr;
    }
开发者ID:dgarkavenko,项目名称:yet-another-applicant-s-space-game,代码行数:43,代码来源:Game.cs

示例4: StartNewGame

    void StartNewGame()
    {
        _menu.OnHideComplete -= StartNewGame;
        _menu.gameObject.SetActive(false);
        Player = PlayerShip.Instantiate(PlayerPrefab);
        Player.transform.position = Vector3.zero;

        Player.OnCollision += OnPlayerCollision;
        Player.OnBeingHit += OnPlayerBeingHit;
        Player.OnWeaponChanged += OnWeaponChanged;

        _hud.Init(Player);

        _currentGameState = _introState;
        _currentGameState.Enter();
    }
开发者ID:dgarkavenko,项目名称:yet-another-applicant-s-space-game,代码行数:16,代码来源:Game.cs


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