private void OnTriggerEnter(Collider other) { var ship = other.GetComponent <SpaceShip>(); if (ship != null) { if (ship.GetOwner() != ownerName) { var hp = ship.GetHP(); var result = ship.Damage(GameParams.GetProjectileInfo(type).damage); if (result <= 0) { ScoreCounter.AddScore(ownerName, 100); } else { ScoreCounter.AddScore(ownerName, hp - result); } Destruct(); } } else { if (other.name.Contains("Planet")) { Destruct(); } if (other.name.Contains("Asteroid")) { other.GetComponent <Asteroid>().Destruct(); Destruct(); } } }
private void UpdateGUI() { GUI.score.text = GameParams.GetScore().ToString(); GUI.lastScore.text = GameParams.GetLastScore().ToString(); GUI.topScore.text = GameParams.GetTopScore().ToString(); GUI.coins.text = GameParams.GetCoins().ToString(); }
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { _main = new Main(); _settings = new Settings(); _game = new Game(); _gameParams = new GameParams(); _main.GameParams = _gameParams; _main.Settings = _settings; _main.NewGameClick += ChangePage; _main.SettingsClick += ChangePage; _main.ExitClick += ExitClick; _settings.Main = _main; _settings.BackClick += ChangePage; _game.Main = _main; _game.ExitClick += ChangePage; _gameParams.Game = _game; _gameParams.Main = _main; _gameParams.ExitClick += ChangePage; _gameParams.StartClick += ChangePage; FMain.Navigate(_main); }
public void SetupBall(GameParams gameParams) { _ball.Reset(); _ball.SetSize(gameParams.BallSize); _ball.SetColor(gameParams.BallColor); _ball.Push(gameParams.StartForce); }
// Update is called once per frame void Update() { /*// Oキー * if (Input.GetKeyDown (KeyCode.O)) { * NextScene = "GameOver"; * } * // Cキー * else if (Input.GetKeyDown (KeyCode.C)){ * NextScene = "Clear"; * NextScene = "GameOver"; * }*/ GameParams.AddScore(-50); // シーン切り替え処理 if (NextScene.Length > 0) { OnDestroy(); SceneManager.LoadSceneAsync(NextScene, LoadSceneMode.Additive); NextScene = ""; enabled = false; } }
// Update is called once per frame void Update() { //GameParams.AddScore (1); if (Input.GetKeyDown(KeyCode.O)) { NextScene = "gameover"; } else if (Input.GetKeyDown(KeyCode.C)) { NextScene = "clear"; NextScene = "gameover"; } //Aキー else if (Input.GetKey(KeyCode.A)) { GameParams.AddScore(10000); } else if (Input.GetMouseButtonDown(1)) { GameParams.AddScore(10000); } if (NextScene.Length > 0) { SceneManager.LoadSceneAsync(NextScene, LoadSceneMode.Additive); NextScene = ""; enabled = false; } }
public void GetAndSetAverageCrystalPriceTest() { //Przygotowanie GameParams g = new GameParams(); Functions f = new Functions(); Round r1 = new Round() { CrystalAveragePrevious = 0, CrystalPurchased = 1 }; Round r2 = new Round() { CrystalAveragePrevious = 0, CrystalPurchased = 0 }; Round r3 = new Round() { CrystalAveragePrevious = g.CrystalPriceConst + g.CrystalPrice, CrystalPurchased = 1, CrystalReserves = 1 }; Round r4 = new Round() { CrystalAveragePrevious = g.CrystalPriceConst + g.CrystalPrice, CrystalPurchased = 0, CrystalReserves = 1 }; double d1 = 0, d2 = 0, d3 = 0, d4 = 0; //Działanie d1 = f.GetAndSetAverageCrystalPrice(r1); d2 = f.GetAndSetAverageCrystalPrice(r2); d3 = f.GetAndSetAverageCrystalPrice(r3); d4 = f.GetAndSetAverageCrystalPrice(r4); //Sprawdzenie Assert.AreEqual(d1, g.CrystalPriceConst + g.CrystalPrice); Assert.AreEqual(d2, 0); Assert.AreEqual(d3, g.CrystalPriceConst + g.CrystalPrice); Assert.AreEqual(d4, 0); }
// Update is called once per frame void Update() { //GameParams.AddScore (1); // Oキー if (Input.GetKeyDown(KeyCode.O)) { NextScene = "GameOver"; } // Cキー else if (Input.GetKeyDown(KeyCode.C)) { NextScene = "Clear"; NextScene = "GameOver"; } // Aキー else if (Input.GetKey(KeyCode.A)) { GameParams.AddScore(50000); } // シーン切り替え処理 if (NextScene.Length > 0) { OnDestroy(); SceneManager.LoadSceneAsync(NextScene, LoadSceneMode.Additive); NextScene = ""; enabled = false; } }
public void GetDismissedWorkerPriceTest() { //Przygotowanie GameParams g = new GameParams(); Functions f = new Functions(); Round r1 = new Round() { DwarfWorkersDismissed = 1 }; Round r2 = new Round() { ElfWorkersDismissed = 1 }; Round r3 = new Round() { HumanWorkersDismissed = 1 }; double d1 = 0, d2 = 0, d3 = 0; //Działanie d1 = f.GetDismissedWorkerPrice(r1); d2 = f.GetDismissedWorkerPrice(r2); d3 = f.GetDismissedWorkerPrice(r3); //Sprawdzenie Assert.AreEqual(d1, g.DismissalPrice); Assert.AreEqual(d2, g.DismissalPrice); Assert.AreEqual(d3, g.DismissalPrice); }
private void changeDirection() { if (flyingRoute != null && flyingDirection != flyingRoute.transform.position) { // find out the angle of the axis flyingDirection = flyingRoute.transform.position; Vector3 heading = flyingDirection - transform.position; // Get a copy of your forward vector //transform.Rotate(heading.normalized); //transform.rotation = transform.rotation*heading; //Quaternion.Slerp(transform.rotation,heading,1f); //GetComponent<Rigidbody> ().velocity=Vector2.zero; Rigidbody rigidbody = GetComponent <Rigidbody> (); //.velocity = heading.normalized * Random.Range (10.0f, 30.0f); rigidbody.velocity = heading.normalized * Random.Range(GameParams.instance().minDuckSpeed, GameParams.instance().maxDuckSpeed); //Vector3 forward = transform.forward; // Zero out the y component of your forward vector to only get the direction in the X,Z plane heading.y = 0; transform.eulerAngles = Quaternion.LookRotation(heading).eulerAngles; //float headingAngle = Quaternion.LookRotation(forward).eulerAngles.y; //transform.Rotate(Vector3.zero); //transform.Rotate(new Vector3(0,headingAngle,0)); } }
public void CountWorkersExpenseTest() { //Przygotowanie GameParams g = new GameParams(); Functions f = new Functions(); Round r1 = new Round() { DwarfWorkers = 1, DwarfWorkersDismissed = 1, DwarfWorkersEmployed = 1 }; Round r2 = new Round() { ElfWorkers = 1, ElfWorkersDismissed = 1, ElfWorkersEmployed = 1 }; Round r3 = new Round() { HumanWorkers = 1, HumanWorkersDismissed = 1, HumanWorkersEmployed = 1 }; double d1 = 0, d2 = 0, d3 = 0; //Działanie d1 = f.CountWorkersExpense(r1); d2 = f.CountWorkersExpense(r2); d3 = f.CountWorkersExpense(r3); //Sprawdzenie Assert.AreEqual(d1, g.WorkerDwarfPrice * g.HoursPerPeriod + g.DismissalPrice + g.EmploymentPrice); Assert.AreEqual(d2, g.WorkerElfPrice * g.HoursPerPeriod + g.DismissalPrice + g.EmploymentPrice); Assert.AreEqual(d3, g.WorkerHumanPrice * g.HoursPerPeriod + g.DismissalPrice + g.EmploymentPrice); }
public void GetCrystalUseTest() { //Przygotowanie GameParams g = new GameParams(); Functions f = new Functions(); Round r1 = new Round() { WandsAmount = 0 }; Round r2 = new Round() { WandsAmount = 1 }; Round r3 = new Round() { WandsAmount = 1000 }; double d1 = 0, d2 = 0, d3 = 0; //Działanie d1 = f.GetCrystalUse(r1); d2 = f.GetCrystalUse(r2); d3 = f.GetCrystalUse(r3); //Sprawdzenie Assert.AreEqual(d1, 0 * g.CrystalConsumption); Assert.AreEqual(d2, 1 * g.CrystalConsumption); Assert.AreEqual(d3, 1000 * g.CrystalConsumption); }
public void GetAndSetAverageWoodPriceTest() { //Przygotowanie GameParams g = new GameParams(); Functions f = new Functions(); Round r1 = new Round() { WoodAveragePrevious = 0, WoodPurchased = g.WoodAmountLow }; Round r2 = new Round() { WoodAveragePrevious = 0, WoodPurchased = 0 }; Round r3 = new Round() { WoodAveragePrevious = g.WoodPriceHigh, WoodPurchased = g.WoodAmountLow, WoodReserves = g.WoodAmountLow }; Round r4 = new Round() { WoodAveragePrevious = g.WoodPriceHigh, WoodPurchased = 0, WoodReserves = g.WoodAmountLow }; double d1 = 0, d2 = 0, d3 = 0, d4 = 0; //Działanie d1 = f.GetAndSetAverageWoodPrice(r1); d2 = f.GetAndSetAverageWoodPrice(r2); d3 = f.GetAndSetAverageWoodPrice(r3); d4 = f.GetAndSetAverageWoodPrice(r4); //Sprawdzenie Assert.AreEqual(d1, g.WoodPriceHigh); Assert.AreEqual(d2, 0); Assert.AreEqual(d3, g.WoodPriceHigh); Assert.AreEqual(d4, 0); }
public void GetTotalWoodPriceTest() { //Przygotowanie GameParams g = new GameParams(); Functions f = new Functions(); Round r1 = new Round() { WoodPurchased = g.WoodAmountLow }; Round r2 = new Round() { WoodPurchased = (g.WoodAmountHigh - g.WoodAmountLow) }; Round r3 = new Round() { WoodPurchased = g.WoodAmountHigh }; double d1 = 0, d2 = 0, d3 = 0; //Działanie d1 = f.GetTotalWoodPrice(r1); d2 = f.GetTotalWoodPrice(r2); d3 = f.GetTotalWoodPrice(r3); //Sprawdzenie Assert.AreEqual(d1, g.WoodPriceHigh * g.WoodAmountLow); Assert.AreEqual(d2, g.WoodPriceMedium * (g.WoodAmountHigh - g.WoodAmountLow)); Assert.AreEqual(d3, g.WoodPriceLow * g.WoodAmountHigh); }
public void GetWorkersPriceTest() { //Przygotowanie GameParams g = new GameParams(); Functions f = new Functions(); Round r1 = new Round() { DwarfWorkers = 1 }; Round r2 = new Round() { ElfWorkers = 1 }; Round r3 = new Round() { HumanWorkers = 1 }; double d1 = 0, d2 = 0, d3 = 0; //Działanie d1 = f.GetWorkersPrice(r1); d2 = f.GetWorkersPrice(r2); d3 = f.GetWorkersPrice(r3); //Sprawdzenie Assert.AreEqual(d1, g.WorkerDwarfPrice * g.HoursPerPeriod); Assert.AreEqual(d2, g.WorkerElfPrice * g.HoursPerPeriod); Assert.AreEqual(d3, g.WorkerHumanPrice * g.HoursPerPeriod); }
public void CountResourcesExpenseTest() { //Przygotowanie GameParams g = new GameParams(); Functions f = new Functions(); Round r1 = new Round() { WoodPurchased = g.WoodAmountLow }; Round r2 = new Round() { CrystalPurchased = 1 }; Round r3 = new Round() { WoodPurchased = g.WoodAmountLow, CrystalPurchased = 1 }; double d1 = 0, d2 = 0, d3 = 0; //Działanie d1 = f.CountResourcesExpense(r1); d2 = f.CountResourcesExpense(r2); d3 = f.CountResourcesExpense(r3); //Sprawdzenie Assert.AreEqual(d1, f.GetTotalWoodPrice(r1)); Assert.AreEqual(d2, f.GetTotalCrystalPrice(r2)); Assert.AreEqual(d3, f.GetTotalWoodPrice(r1) + f.GetTotalCrystalPrice(r2)); }
// Update is called once per frame void Update() { var cam = Camera.main; CheckBonusesAmount(); for (int i = 0; i < GameContext.Instance.bonuses.Count; i++) { Vector3 screenPos = cam.WorldToScreenPoint(GameContext.Instance.bonuses[i].transform.position); bonuses[i].rectTransform.position = screenPos; try { var wb = GameContext.Instance.bonuses[i] as WeaponBonus; Debug.Log(wb.projectileType); var info = GameParams.GetProjectileInfo(wb.projectileType); bonuses[i].sprite = info.icon.sprite; } catch (System.Exception e) { bonuses[i].sprite = hpSprite.sprite; } // bonuses[i].transform.localScale = new Vector3((float)(GameContext.Instance.ships[i].health) / (float)GameParams.SPACESHIP_MAX_HP, 1, 0); } }
public void ClickedBuy(int itemID) { GameParams.SetCoins(GameParams.GetCoins() - GetItem(itemID).Price); for (int i = 0; i < transform.childCount; i++) { if (GetItem(i).State == "ACTUAL") { GetItem(i).State = "OPEN"; } } GetItem(itemID).State = "ACTUAL"; // init location if (GetItem(itemID).KeyItem) { for (int i = 0; i < locationContent.transform.childCount; i++) { if (i == transform.GetChild(itemID).GetComponent <KeyItem>().locationID) { Data.locations[i] = "UNLOCKED"; } } } if (GetItem(itemID).KeyItem) { transform.GetChild(itemID).GetComponent <KeyItem>().OnLockItem(); } for (int i = 0; i < transform.childCount; i++) { InitState(i); } am.PlayClickPicupcoin(); }
public void Post([FromBody] GameParams gameParams) { try { using (GamesManagementServiceClient gmsClient = new GamesManagementServiceClient()) { Game game = new Game { GameString = gameParams.GameString, PlayedAs = gameParams.PlayedAs == 'w' ? Game.Player.White : Game.Player.Black }; gmsClient.SaveGame(game, gameParams.Token); } } catch (FaultException <GamesManagementFault> ex) { if (ex.Detail.FaultType == GamesManagementFault.GamesManagementFaultType.TokenExpired) { throw new HttpResponseException(SetHttpErrorMsg("Token Expired. Re-login.", HttpStatusCode.Unauthorized)); } else if (ex.Detail.FaultType == GamesManagementFault.GamesManagementFaultType.InvalidSignature) { throw new HttpResponseException(SetHttpErrorMsg("Invalid Token Signature.", HttpStatusCode.Unauthorized)); } else { throw new HttpResponseException(SetHttpErrorMsg("Internal Server Error.", HttpStatusCode.InternalServerError)); } } }
public void SetupGame(GameParams gameParams) { Debug.Log($"Setting up game for {gameParams.localTeam} team."); this.gameParams = gameParams; SmoothHalfOrbitalCamera cam = GameObject.FindObjectOfType <SmoothHalfOrbitalCamera>(); cam?.SetDefaultTeam(gameParams.localTeam); whiteKeys.SetActive(gameParams.localTeam == Team.White); blackKeys.SetActive(gameParams.localTeam == Team.Black); board.currentGame.ChangeTimeParams(gameParams.showClock, gameParams.timerDuration); if (gameParams.timerDuration <= 0) { // Game has no timer, but might have a clock timers.gameObject.SetActive(gameParams.showClock); timers.isClock = gameParams.showClock; } else { // Game has a timer timers.gameObject.SetActive(true); timers.SetTimers(gameParams.timerDuration); } if (gameParams.localTeam == Team.White) { turnChangePanel.Display(gameParams.localTeam); } }
private void Initialize(Rigidbody rigidbody, IInput input, GameParams gameParams) { _rigidBody = rigidbody; _input = input; _gameParams = gameParams; _input.OnClick += OnClicked; }
private void OnCollisionEnter(Collision collision) { if (!GameBehaviour.isPlayable) { return; } if (collision.gameObject.CompareTag("Player")) { sphereCollider.enabled = false; rb.velocity = Vector3.zero; SoundManager.PlaySE(SoundManager.AUDIO_LIST.ITEM); GameParams.AddScore(point * EnemySpawner.enemyCount); EnemySpawner.IncrementEnemy(); EnemySpawner.ChangeDir(); anim.SetTrigger("Get"); if (getParticle != null) { Instantiate(getParticle, transform.position, Quaternion.identity); } } }
public List <Game> RecommendGames( List <GameParams> games, GameParams templateGame, int numberSimilarGames, Dictionary <string, int> tagDict) { ISimilarityCalculator calculator = new SimilarityCalculator(); List <Game> boxingGames = new List <Game>(); double coef; foreach (var game in games) { coef = calculator.CalculateSimilarity( game, templateGame, Relations.Universes, Relations.Characters, Relations.ImportanceUniverse, Relations.ImportanceCharacter, tagDict); boxingGames.Add(new Game(game, coef)); } boxingGames.Sort(); var countGames = numberSimilarGames < games.Count ? numberSimilarGames : games.Count; boxingGames = boxingGames.GetRange(0, countGames); return(boxingGames); }
// Update is called once per frame void Update() { // oキー if (Input.GetKeyDown(KeyCode.O)) { NextScene = "Game Over"; // cキー } else if (Input.GetKeyDown(KeyCode.C)) { NextScene = "Clear"; } //Aキー else if (Input.GetKey(KeyCode.A)) { GameParams.AddScore(1000); } if (NextScene.Length > 0) { SceneManager.LoadSceneAsync(NextScene, LoadSceneMode.Additive); NextScene = ""; enabled = false; } }
void Start() { GameParams.DrawScore(); /*// タイトルクリック時の音の変数 * sound1 = GetComponent<AudioSource> ();*/ }
void Start() { //GameManager.PlaySE (2); GameParams.MaxScoreC(); GameParams.DrawScore(); }
public void Init(GameParams gameParams) { _tileController.Cleanup(); _crystalController.Cleanup(); _tileController.Init(gameParams.Difficulty); _crystalController.Init(gameParams.CrystalGenerationMode); }
public GameParams Tick(GameParams gameParams) { var gameTick = new GameParams(); gameTick.GameRows = gameOfLifeHelper.GameTick(gameParams.Size, gameParams.GameRows); gameTick.Size = gameParams.Size; return(gameTick); }
private void FixedUpdate() { if (!isPlayable) { return; } GameParams.AddScore((float)EnemySpawner.enemyCount * Time.fixedDeltaTime); }
public async Task <IActionResult> Games([FromQuery] GameParams gameFilers) { int totalCount = await gameService.GetGamesCountAsync(); int totalPages = (int)Math.Ceiling(totalCount / (double)gameFilers.PageSize); Response.AddPagination(gameFilers.CurrentPage, gameFilers.PageSize, totalCount, totalPages); return(Ok(new { games = await gameService.GetGamesAsync(gameFilers) })); }