/// <summary> /// The human client will take on the race of the first 'opponent' in the gamesettings file. /// </summary> /// <param name="race">Race to play</param> public HumanClient(GameSettings gameSettings, GameSpeed speed = GameSpeed.Faster, ILogger log = null) { _settings = gameSettings; _client = new GameClient(_settings, log); _speed = speed; _log = log; }
public static float GameloopsPerSecond(GameSpeed speed) { switch (speed) { case GameSpeed.Slower: return(9.6f); case GameSpeed.Slow: return(12.8f); case GameSpeed.Normal: return(16f); case GameSpeed.Fast: return(19.2f); case GameSpeed.Faster: return(22.4f); case GameSpeed.MaximumSpeed: return(float.MaxValue); default: throw new System.NotImplementedException(); } }
private Int32 _wallsCount; // lerakott falak száma #endregion Fields #region Constructors public RobotGameModel() { _gameSpeed = GameSpeed.Fast; _gameSize = GameSize.Small; _gameActive = false; _first = false; }
void Awake() { gameSpeed = GameObject.Find("Game Speed").GetComponent <GameSpeed>(); selectionMenuImage = selectionMenu.GetComponent <Image>(); distanceToMove = selectionMenuImage.rectTransform.rect.width / 6; Color color = selectionMenuImage.color; color.a = 0; selectionMenuImage.color = color; StartCoroutine(FadeIn()); foreach (Transform child1 in selectionMenu.transform) { child1.GetComponent <Image>().color = color; foreach (Transform child2 in child1) { if (child2.gameObject.name == "Price" || child2.gameObject.name == "ResourceLogo") { child2.gameObject.SetActive(true); } } } }
public void SwitchGameSpeed(GameSpeed gameSpeed) { SetButtonColor(currentGameSpeed.speedButton, Color.white); SetGameSpeed(gameSpeed.speed); SetButtonColor(gameSpeed.speedButton, Color.green); currentGameSpeed = gameSpeed; }
/// <summary> /// コンストラクタ /// </summary> /// <param name="playerModelObject"></param> public GameOverEvent(GameObject playerModelObject, EventManager eventManager) : base(playerModelObject, eventManager) { eventCanvas = eventManager.GetEventCanvas(); gameSpeed = eventManager.GameSpeed; sceneChangeRelay = eventManager.SceneChangeRelay; eventEndTimer = new Timer(5.0f); }
// change the game speed private void ChangeSpeed(GameSpeed speed) { gameSpeed = speed; foreach (Letter letter in wordLetterList) { letter.Speed = gameSpeed; } }
private void Awake() { Instance = this; m_CurGameSpeed = GameSpeed.Normal; m_CacheGameSpeed = GameSpeed.Stop; Mgr_AssetBundle.Instance.Init(); LoadBaseAsset(); }
void Start() { initCamera(); grid = new Grid(GRID_SIZE_X, GRID_SIZE_Y, NODE_SCALE, NODE_OUTLINE); algorithm = new AStar(grid); speed = GameSpeed.PAUSED; timeSinceLastUpdate = 0.0f; }
void Start() { speed = GameObject.Find("CanvasDay").GetComponent <GameSpeed> (); currentAdventurer = GetComponent <Actor> (); moving = false; cooldown = (float)100 / (float)currentAdventurer.mooveSpeed; cooldownTimer = cooldown; }
/// <summary> /// Инициализирует объект конфигурации онлайн игры /// </summary> /// <param name="onlineRole">Роль игрока в текущей игре</param> /// <param name="connection">Строка соединения</param> /// <param name="gameSpeed">Скорость игры (ограничение по времени на ход)</param> /// <param name="gameStatus">Статус игры</param> public GameConfig(PlayerRole onlineRole, string connection, GameSpeed gameSpeed = GameSpeed.Medium, GameStatus gameStatus = GameStatus.Game) { IsOnline = true; Connection = connection; OnlineRole = onlineRole; GameSpeed = gameSpeed; GameStatus = gameStatus; }
void Start() { Speed = GameSpeed.NORMAL; if (CurrentState == null) { ChangeState <PauseState>(); } }
private void Awake() { this.score = 0; this.isPlaying = true; this.gameSpeed = GameSpeed.One; uiCountDown.StartCountDown(); }
//原本的测试 // public UICountDown CountDown; void Awake() { this.Score = 0; this.IsPlaying = true; this.Speed = GameSpeed.One; // CountDown.StartCountDown(); }
/// <summary> /// Determine the number of weeks elapsing per second based on given game speed setting /// </summary> private int WeeksPerSecond(GameSpeed speed) { return(speed switch { GameSpeed.Paused => 0, GameSpeed.Slow => 1, GameSpeed.Normal => 4, GameSpeed.Fast => 12, });
private void OnGameStarted() { currentGameSpeed = gameSpeeds[0]; foreach (GameSpeed item in gameSpeeds) { SetButtonColor(item.speedButton, Color.white); } SwitchGameSpeed(currentGameSpeed); }
public void HandleBrokenBlock() { MoveUpBlocks(); topBlock = iceBlocks[0].GetComponent <IceBlockBehaviour>(); SpawnNewBlock(2); ScoreBehaviour.AddPoints(1); GameSpeed.IncreaseSpeed(); }
/// <summary> ///コンストラクタ /// </summary> /// <param name="playerModelObject"></param> public CurveEvent(GameObject playerModelObject, EventManager eventManager) : base(playerModelObject, eventManager) { playerMove = playerModelObject.GetComponent <PlayerMove>(); GameObject laneObject = this.playerModelObject.GetComponentInParent <Player>().LaneObject; lanePositions = laneObject.GetComponent <LanePositions>(); gameSpeed = eventManager.GameSpeed; middleCheckTimer = new Timer(0.5f); }
protected override void RecordPopupListState(GuiElementID popupListID, string selection, string convertedSelection) { base.RecordPopupListState(popupListID, selection, convertedSelection); switch (popupListID) { case GuiElementID.GameSpeedOnLoadPopupList: _gameSpeedOnLoad = Enums<GameSpeed>.Parse(selection); break; default: throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(popupListID)); } }
public void OnSpeed1Click() { if (Speed == GameSpeed.One) { Speed = GameSpeed.Two; Time.timeScale = Time.timeScale * 2; btnSpeed1.gameObject.SetActive(Speed != GameSpeed.Two); btnSpeed2.gameObject.SetActive(Speed == GameSpeed.Two); } }
// Constructors public Engine(IVisualizer visualizer, IGameController gameController, GameSpeed gameSpeed = GameSpeed.Slowest) { this.visualizer = visualizer; this.gameController = gameController; this.allObjects = new List<GameObject>(); this.movingObjects = new List<MovingObject>(); this.staticObjects = new List<GameObject>(); this.textObjects = new List<TextObject>(); this.gameSpeed = gameSpeed; }
public static double GetSpeedValue(GameSpeed speed) { int speedValue = (int)speed; if (speedValue == 0) // no settings - used default value { return(1); } return(speedValue * 0.01); }
/// <summary> /// Initializes a new Letter object with the letter, x location, y location, texture, and initial speed /// </summary> /// <param name="c">represents a single letter of the alphabet</param> /// <param name="x">x location</param> /// <param name="y">y location</param> /// <param name="texture">texture for the letter</param> /// <param name="gameSpeed">game speed represented by GameSpeed constants</param> public Letter(char c, int x, int y, Texture2D texture, GameSpeed gameSpeed) { this.c = c; this.texture = texture; drawRectangle = new Rectangle(x, y, texture.Width, texture.Height); // Starting speed this.gameSpeed = gameSpeed; gameSpeedChanged = true; velocity = new Vector2(0, GameConstants.VERY_SLOW); }
public void Revive(int noLives) { var lives = FindObjectOfType <LivesHandler>(); lives.IncreaseLives(noLives); gameOverPanel.SetActive(false); GameSpeed gameSpeed = FindObjectOfType <GameSpeed>(); Time.timeScale = gameSpeed.GetCurrentTimeScale(); }
public void Test_GameController_Registers_Values(GameSpeed gameSpeed, GameState gameState, GameSpeed expectedGameSpeed, GameState expectedGameState) { // Arrange GameController controller; // Act controller = new GameController(gameSpeed, gameState); // Assert Assert.AreEqual(controller.GameSpeed, expectedGameSpeed); Assert.AreEqual(controller.GameState, expectedGameState); }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <returns> /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false. /// </returns> /// <param name="other">An object to compare with this object.</param> public bool Equals(GameplaySettings other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(AutoIncreaseSpeed == other.AutoIncreaseSpeed && GameSpeed.Equals(other.GameSpeed) && Equals(LeftPaddleType, other.LeftPaddleType) && Equals(RightPaddleType, other.RightPaddleType) && BallCount == other.BallCount && TimeLimit.Equals(other.TimeLimit) && ScoreLimit == other.ScoreLimit); }
void INotifyCreated.Created(Actor self) { ShortGame = self.World.LobbyInfo.GlobalSettings .OptionOrDefault("shortgame", info.ShortGameCheckboxEnabled); TechLevel = self.World.LobbyInfo.GlobalSettings .OptionOrDefault("techlevel", info.TechLevel); var speed = self.World.LobbyInfo.GlobalSettings .OptionOrDefault("gamespeed", info.GameSpeed); GameSpeed = Game.ModData.Manifest.Get <GameSpeeds>().Speeds[speed]; }
public void decreaseGameSpeed() { if (speed == GameSpeed.FAST) { speed = GameSpeed.MEDIUM; plusButton.GetComponent <Button> ().interactable = true; } else if (speed == GameSpeed.MEDIUM) { speed = GameSpeed.SLOW; minusButton.GetComponent <Button> ().interactable = false; } }
void OnScoreChange(ScoreManager sm) { int nextSpeedIdx = CurrGameSpeedIdx + 1; if (nextSpeedIdx < gameSpeedLevels.Length) { GameSpeed nextGameSpeed = gameSpeedLevels[nextSpeedIdx]; if (sm.Score >= nextGameSpeed.scoreThresholdToActivate) { CurrGameSpeedIdx = nextSpeedIdx; } } }
/* Selects a level information at random from the avaiable levels * and generates its corresponding objects on the Scene*/ public void LoadLevelLayout() { //////////////////////////////////Random level selection goes here //currentSpeed = speedValues[(int) gameSpeedSetting]; //Sets Spped if (currentGameMode == GameMode.Debug) { HeaderLevelDetails.instance.FillDetails(levelSelected); } difficultySetting = levelSelected.difficulty; gameSpeedSetting = levelSelected.gameSpeed; currentSpeed = speedValues[(int)levelSelected.gameSpeed]; float platformXLimit = platformsOrigin.x + (platformXOffset * 3); //Sets the spaces between rows an columns float platformZLimit = platformsOrigin.z + (platformZOffset * 3); int i = 0; //keeps count of the object's index from the selected level /*This loop increments the value from the initial position on an interval equal to the * spaces between each platform to instantiate them in the correct position*/ for (float row = platformsOrigin.x; row <= platformXLimit; row += platformXOffset) { for (float column = platformsOrigin.z; column <= platformZLimit; column += platformZOffset) { platformPositions[i] = new Vector3(row, platformsOrigin.y, column); /*The Manager creates a platform based on the platform types's enum value, * interpreting it as an index from its array of platforms*/ GameObject g = Instantiate(platformPool[(int)levelSelected.GetPlatformType(i)], new Vector3(row, platformsOrigin.y, column), Quaternion.identity); g.transform.localScale = platformsScale; //NOTE: Add Object Attached (make g a parent of said object if aplicable) //Set the corresponding properties of the platform specified in the config file if (levelSelected.GetPlatformType(i) == PlatformType.DirectionChanger) { g.GetComponent <DirectionChangerPlatform>().SetSettings(levelSelected.GetPlatformSettings(i)); } //Add the Moving Platform's properties to the created platform if aplicable if (levelSelected.GetPlatformSettings(i).IsThePlatformMovable()) { g.AddComponent <MovingPlatform>().SetSettings(levelSelected.GetPlatformSettings(i)); } g.transform.parent = stage.transform; platformReferences.Add(g); i++; } } }
/// <summary> /// Serves as the default hash function. /// </summary> /// <returns> /// A hash code for the current object. /// </returns> public override int GetHashCode() { unchecked { var hashCode = AutoIncreaseSpeed.GetHashCode(); hashCode = (hashCode * 397) ^ GameSpeed.GetHashCode(); hashCode = (hashCode * 397) ^ (LeftPaddleType != null ? LeftPaddleType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (RightPaddleType != null ? RightPaddleType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ BallCount; hashCode = (hashCode * 397) ^ TimeLimit.GetHashCode(); hashCode = (hashCode * 397) ^ ScoreLimit; return(hashCode); } }
protected override void Initialize() { base.Initialize(); MouseReader.Initialize(); RawKeyboardInput.Initialize(); RawGamepadInput.Initialize(); GameSpeed.Reinitialize(); GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp; DebugHelper.Initialize(); MouseVisible = StartMouseVisible; InitializeGame(); }
static void StartGame(double rooms, int floors, GameSpeed speed) { Motel vMotel = new Motel(rooms, floors); Game vGame = new Game(vMotel, speed); TimerCallback timerCallBack = vGame.TickTock; Timer vTimer = new Timer(timerCallBack, null, 1000, vGame.GetRefreshRate()); HandlingInput vInput = new HandlingInput(vGame); Console.Clear(); vGame.Help(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); Console.Clear(); vGame.RoomReport(); vInput.Play(); }
void Awake() { gameSpeed = GameObject.Find("Game Speed").GetComponent<GameSpeed>(); selectionMenuImage = selectionMenu.GetComponent<Image>(); distanceToMove = selectionMenuImage.rectTransform.rect.width / 6; Color color = selectionMenuImage.color; color.a = 0; selectionMenuImage.color = color; StartCoroutine(FadeIn()); foreach (Transform child1 in selectionMenu.transform) { child1.GetComponent<Image>().color = color; foreach (Transform child2 in child1) { if (child2.gameObject.name == "Price" || child2.gameObject.name == "ResourceLogo") { child2.gameObject.SetActive(true); } } } }
private void GameSpeedPropChangingHandler(GameSpeed newGameSpeed) { float previousGameSpeedMultiplier = _gameTime.GameSpeedMultiplier; float newGameSpeedMultiplier = newGameSpeed.SpeedMultiplier(); float gameSpeedChangeRatio = newGameSpeedMultiplier / previousGameSpeedMultiplier; AdjustForGameSpeed(gameSpeedChangeRatio); }
private void OnGameSpeedChanging(GameSpeed newSpeed) { // OPTIMIZE static? //D.Log("{0}.OnGameSpeedChanging() called. OldSpeed = {1}, NewSpeed = {2}.", GetType().Name, GameTime.Instance.GameSpeed.GetName(), newSpeed.GetName()); float currentSpeedMultiplier = GameTime.Instance.GameSpeed.SpeedMultiplier(); float speedChangeRatio = newSpeed.SpeedMultiplier() / currentSpeedMultiplier; _hudRefreshRate *= speedChangeRatio; }
private void OnGameSpeedChanging(GameSpeed newGameSpeed) { _courseUpdateFrequency *= GameTime.Instance.GameSpeed.SpeedMultiplier() / newGameSpeed.SpeedMultiplier(); }
/// <summary> /// Adjusts the velocity and thrust of the fleet to reflect the new GameClockSpeed setting. /// The reported speed and directional heading of the fleet is not affected. /// </summary> /// <param name="gameSpeed">The game speed.</param> private void AdjustForGameSpeed(GameSpeed gameSpeed) { float previousGameSpeedMultiplier = _gameSpeedMultiplier; // FIXME where/when to get initial GameSpeed before first GameSpeed change? _gameSpeedMultiplier = gameSpeed.SpeedMultiplier(); float gameSpeedChangeRatio = _gameSpeedMultiplier / previousGameSpeedMultiplier; // must immediately adjust velocity when game speed changes as just adjusting thrust takes // a long time to get to increased/decreased velocity if (_gameStatus.IsPaused) { _velocityOnPause = _velocityOnPause * gameSpeedChangeRatio; } else { _rigidbody.velocity = _rigidbody.velocity * gameSpeedChangeRatio; // drag should not be adjusted as it will change the velocity that can be supported by the adjusted thrust } }
private Int32 _wallsCount; // lerakott falak száma #endregion Fields #region Constructors /// <summary> /// Robot játék példányosítása. /// </summary> /// <param name="dataAccess">Az adatelérés.</param> public RobotGameModel() { _gameSpeed = GameSpeed.Normal; _first = false; }
public void PauseResume() { objectManager.AudioManager.PlayButtonSound(); if (objectManager.gameState.GameSpeed == GameSpeed.Paused) { objectManager.gameState.GameSpeed = prePauseSpeed; } else { prePauseSpeed = objectManager.gameState.GameSpeed; objectManager.gameState.GameSpeed = GameSpeed.Paused; } PauseButtonAnimator.SetTrigger("toggle"); }
private void RefreshReadout(GameSpeed clockSpeed) { RefreshReadout(CommonTerms.MultiplySign + clockSpeed.SpeedMultiplier().ToString()); }