本文整理汇总了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);
}
示例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();
}
}
示例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;
}
示例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();
}