void IState.Update() { Cmd.Checkbinds(); _keys[_cursor].Tick(); if (Input.IsKeyPressed(SFML.Window.Keyboard.Key.Down)) { int pc = _cursor; _cursor = (_cursor + 1).Clamp(0, _keys.Count - 1); if (pc != _cursor) { Audio.PlaySound2D("sound/ui/hover"); } } if (Input.IsKeyPressed(SFML.Window.Keyboard.Key.Up)) { int pc = _cursor; _cursor = (_cursor - 1).Clamp(0, _keys.Count - 1); if (pc != _cursor) { Audio.PlaySound2D("sound/ui/hover"); } } if (Input.IsKeyPressed(SFML.Window.Keyboard.Key.Escape)) { if (Statemanager.history.Peek() != null) { Statemanager.GoBack(); } } }
void Start() { enemyHolder = allEnemyHolder; gameOnPlay = true; canSpawn = true; spawnX = Screen.width / 10 + Screen.width; playerDead = false; Run = false; SpawnPlayer(); deathScript = player.GetComponent <PlayerDeath>(); score = GetComponent <ScoreCounter>(); stage = GetComponent <Statemanager>(); music.Play(); }
void IState.Init() { _keys.Clear(); _keys.Add(new OptionButton("forward", delegate() { Statemanager.SetState(new Controls()); })); }