// Use this for initialization void Start() { gs = this; coinScore = 0; distance = 0; totalScore = 0; }
public void SetGameScore(GameScore gameScore) { leftPlayerName.text = gameScore.leftPlayerName; leftScoreText.text = gameScore.leftPlayerScore; rightPlayerName.text = gameScore.rightPlayerName; rightScoreText.text = gameScore.rightPlayerScore; totalScoreText.text = gameScore.totalScore; playerNameWhoWonText.text = $"{gameScore.playerNameWhoWon} Won!!"; }
private void Die() { GameObject scoreText = Instantiate(_score3DTextPrefab, this.transform.position, Quaternion.identity) as GameObject; scoreText.GetComponent <KillScoreInfo>().ShowScore(_scoreValue.ToString()); Instantiate(_deathExplosionPrefab, _bodyTransform.position, Quaternion.identity); AudioSource.PlayClipAtPoint(gettingHitSounds[Random.Range(0, gettingHitSounds.Length)], _bodyTransform.position, 1f); AudioSource.PlayClipAtPoint(_deathSound, _bodyTransform.position, 5f); GameScore.UpdateScore(_scoreValue); Destroy(this.gameObject); }
public ActionResult Create([Bind(Include = "ID,Name,Points")] GameScore gameScore) { if (ModelState.IsValid) { db.GameScores.Add(gameScore); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gameScore)); }
void MakeSingleInstance() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }
void Start() { gm = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <GameScore>(); lm = FindObjectOfType <LoadMateri> (); ch = GameObject.Find("character"); rip = FindObjectOfType <death> (); cus = FindObjectOfType <flash> (); //thescoremanager = FindObjectOfType<scoremanager>(); }
void RenderBag() { ScoreText.text = GameScore.ToString(); BackroundRenderer.material.color = Color.Lerp(Color.black, Color.blue, BackroundColorLerp); BackroundColorLerp = Mathf.Lerp(BackroundColorLerp, 0, Time.deltaTime * 10); BackroundColorVelocity = Mathf.Lerp(BackroundColorLerp, 1, Time.deltaTime); }
void Start() { mQuarTime = new QuarterTime(); mDownAndDis = new DownAndDistance(); mScores = new GameScore(); mGameState = GAME_STATE.PRESNAP; // kind of a hack, move this later. SetFirstDownSpot(); PlayRestart(); }
public override void Interact() { if (State == ItemState.Disabled) { if (GameScore.CurrentEnergy - GameSettings.MAIN_FRAME_ENERGY_GAIN < 1f) { base.Interact(); GameScore.AddEnergy(GameSettings.MAIN_FRAME_ENERGY_GAIN); AudioController.Instance.Play(Tags.SFX_Interact_MainFrame); } } }
void Awake() { DontDestroyOnLoad(this.gameObject); if (main == null) { main = this; } else { Destroy(gameObject); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
void Update() { if (Input.GetKey(KeyCode.R)) //Si la tecla R se llega a apretar { GameScore.resetScore(); //Mandamos a llamar la funcion de resetscore in gamescore GetComponent <Rigidbody2D> ().velocity = new Vector2(0, 0); //Se regresa la velocidad a 0,0 GetComponent <Rigidbody2D> ().transform.position = new Vector2(0, 0); //Se regresa la bola a la posicion 0,0 player1.transform.position = new Vector2(-0.05f, -2.78f); //Regresamos la posicion de ambos jugadores player2.transform.position = new Vector2(-0.05f, 2.82f); //Regresamos la posicion de ambos jugadores. StartCoroutine(InitiateBall()); //Volvemos a llamar la funcion de initiateball } }
void Awake() { if (!Instance) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
private void Start() { score = new GameScore(); difficulty = Difficulty.EASY; Events.OnSelectFigure += Event_OnSelectFigure; Events.OnClickPlaceholder += Event_OnClickPlaceholder; Events.OnGameEnded += Event_OnGameEnded; Events.OnGameRestart += Event_OnGameRestart; Events.OnDifficultyChange += Event_OnDifficultyChange; Events.OnBackToMain += Event_OnBackToMain; }
//singleton void Awake() { if (instance != null && instance != this) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); //persiste entre as cenas } }
public override void Interact() { if (State == ItemState.Disabled) { if (GameScore.CurrentEnergy >= GameSettings.WATER_PUMP_COST) { base.Interact(); GameScore.AddEnergy(-GameSettings.WATER_PUMP_COST); AudioController.Instance.Play(Tags.SFX_Interact_WaterPump); _ground.FloodVelocity -= GameSettings.WATER_PUMP_DECREASE_FLOOD_VELOCITY; } } }
public async Task <List <GameScore> > GetScoresAroundMeAsync(string gamerTag, int radius) { GameScore score = await _db.GetGamerRankAsync(gamerTag); if (score == null) { return(null); } List <GameScore> res = await _db.GetScoresAroundMeAsync(gamerTag, score.Rank, radius); return(res.OrderBy(s => s.Rank).ToList()); }
private void LoadJsonFile() { if (File.Exists(pathJosn)) { string dataAsJson = File.ReadAllText(pathJosn); GameScore newGS = JsonUtility.FromJson <GameScore>(dataAsJson); print(newGS); } else { print("no File"); } }
public void DeuceShouldAdvantage() { var score = new GameScore(); score.JokoWinPoint(); score.JokoWinPoint(); score.JokoWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); Assert.AreEqual("advantage rafa", score.Score); }
// // Submit button public void Submit() { int score = GameScore.GetScore(); // post high score string name = nameInput.text; HighScoreClient.ScorePair pair = new HighScoreClient.ScorePair(); pair.Name = name; pair.Score = score; highScoreClient.PostNewHighScore(pair, OnComplete); }
public override void SaveHighScoreIfNecessary(GameScore currentGame) { var bestGame = GetHighScore(); if (bestGame == null || bestGame.BestAttempt > currentGame.BestAttempt) { using (var db = new GameContext()) { db.GameScores.RemoveRange(db.GameScores); db.GameScores.Add(currentGame); db.SaveChanges(); } } }
public void ShouldDeuce() { var score = new GameScore(); score.JokoWinPoint(); score.JokoWinPoint(); score.JokoWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); Assert.AreEqual("40", score.JokoGameScore.Points); Assert.AreEqual("40", score.RafaGameScore.Points); Assert.AreEqual("deuce", score.Score); }
void Start() { // dpadRed.enabled = false; // dpadGreen.enabled = false; // readyUp.enabled = false; disableAssassin.enabled = false; //disableAssassinTakedown.enabled = false; disableBodyguard.enabled = false; StartCoroutine(StartHideMainTitle()); musicSource.Play(); gameScore = GameObject.FindGameObjectWithTag("Environment").GetComponent <GameScore>(); assassinPlayerNum = gameScore.getAssassinPlayerNum(); }
public async Task <GameScore> Create(string userId, string userEmail, int highScore) { var newGameScore = new GameScore() { UserId = userId, UserEmail = userEmail, HighScore = highScore }; _gameScoreRepository.Add(newGameScore); await _gameScoreRepository.SaveChangesAsync(); return(newGameScore); }
public void RafaShouldWin() { var score = new GameScore(); score.JokoWinPoint(); score.JokoWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); Assert.AreEqual("30", score.JokoGameScore.Points); Assert.AreEqual("game", score.RafaGameScore.Points); Assert.AreEqual("game rafa", score.Score); }
private Game ConvertGame(GameScore gs) { return(new Game { KickOff = DateTimeParser.ParseDate(gs.KickOffAt), HomeTeam = dbUnit.Teams.Get() .Where(t => t.Name.Equals(gs.HomeTeam)) .FirstOrDefault(), AwayTeam = dbUnit.Teams.Get() .Where(t => t.Name.Equals(gs.AwayTeam)) .FirstOrDefault(), MatchDay = GetMatchday(gs) ?? CreateMatchDay(gs) }); }
// GET: GameScores/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GameScore gameScore = db.GameScores.Find(id); if (gameScore == null) { return(HttpNotFound()); } return(View(gameScore)); }
void LoadScore() { if (File.Exists(filePath + "/" + FILE_NAME)) { string loadedJson = File.ReadAllText(filePath + "/" + FILE_NAME); gameScore = JsonUtility.FromJson <GameScore>(loadedJson); Debug.Log("File loaded successfully"); } else { gameScore.score = 100; Debug.Log("File not found"); } }
public void AdvantageShouldBackToDeuce() { var score = new GameScore(); score.JokoWinPoint(); score.JokoWinPoint(); score.JokoWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); score.RafaWinPoint(); score.JokoWinPoint(); Assert.AreEqual("deuce", score.Score); }
public async Task <IList <GameScore> > GetPlayerScores(int playerId) { string query = @"SELECT ps.player_id, ps.score, ps.session_start, ps.session_end FROM player_stats ps INNER JOIN player ON ps.player_id = player.player_id WHERE player.player_id = @ID"; List <GameScore> playerScores = new List <GameScore>(); using (var connection = new SqlConnection(ConnectionString)) { await connection.OpenAsync(); using (var tran = connection.BeginTransaction()) { using (var command = new SqlCommand(query, connection, tran)) { try { command.Parameters.Add("@ID", SqlDbType.NVarChar); command.Parameters["@ID"].Value = playerId; SqlDataReader rdr = await command.ExecuteReaderAsync(); while (rdr.Read()) { GameScore gameScore = new GameScore { Score = (int)rdr["score"], SessionStart = DateTime.Parse(rdr["session_start"].ToString()), SessionEnd = DateTime.Parse(rdr["session_end"].ToString()) }; playerScores.Add(gameScore); } await rdr.CloseAsync(); } catch (Exception Ex) { await connection.CloseAsync(); string msg = Ex.Message.ToString(); tran.Rollback(); throw; } } } } return(playerScores); }
public void UpdateScoresFailure() { var gameScore = new GameScore { AwayTeam = "BASEL", HomeTeam = "MANUTD", Group = "A", KickOffAt = "2017-09-28T66:00:00", LeagueTitle = "Champions League 2017/18", MatchDay = 1, Score = "2:0" }; Assert.Throws <ClientRequestException>(() => service.UpdateScores(new GameScore[] { gameScore })); }
partial void InsertGameScore(GameScore instance);
// coroutine for api to send score to database private IEnumerator WaitRequestSendScore(GameScore gs){ string gsJson = JsonUtility.ToJson (gs); //var encoding = new System.Text.UTF8Encoding(); var postHeader = new Dictionary<string, string>(); postHeader.Add("Content-Type", "text/json"); //postHeader.Add("Content-Length", gsJson.Length.ToString()); using (var www = new WWW(sendscoresurl, Encoding.UTF8.GetBytes(gsJson), postHeader)) { yield return www; if (www.error == null) { //no error AddScoreReturn returnValue = JsonUtility.FromJson<AddScoreReturn> (www.text); //if get a correct response then show the leaderboards on the page on which the user's score is diplayed NavController.OnButtonLeaderboards (); HighScores (((returnValue.rank) / scoresPerPage)); } //error sending the score and receiving appropriate response else { PopUpText.text = "ERROR: Score could not be added."; HighScorePopUP.SetActive (true); isScoreError = true; } } }
partial void DeleteGameScore(GameScore instance);
// Use this for initialization void Start() { timeLimit = defaulTimeLimit; timeNumber = (int)timeLimit; gamescore = GetComponent<GameScore>(); //itemmanager2 = GetComponent<ItemManager2>(); //defaultColor = countTime.GetComponent<Text>().color; //countTime.GetComponent<Text> ().text = defaulTimeLimit.ToString (); }
//function called when user clicks submit for gameover public void AddScore() { if (NameInput.text != "" && TeamInput.text != "") { AddScoreButton.interactable = false; GameScore sendingScore = new GameScore () { Id = null, Name = NameInput.text, TeamName = TeamInput.text, Score = player.Score, LoansClosed = player.NumPropertiesClosed }; //start api call StartCoroutine (WaitRequestSendScore (sendingScore)); } else { //if the user did not enter both the name and team name an error message opens HighScorePopUP.SetActive (true); PopUpText.text = "You must enter both a name and team name to submit a high score."; } }
public static string GameScoreToString(GameScore score) { string sRet = "_ : _"; switch (score) { case GameScore.NotSet: sRet = "_ : _"; break; case GameScore.Score_BYE: sRet = " BYE "; break; case GameScore.Score_0_0: sRet = "0 : 0"; break; case GameScore.Score_0_1: sRet = "0 : 1"; break; case GameScore.Score_1_0: sRet = "1 : 0"; break; case GameScore.Score_1_1: sRet = "1 : 1"; break; case GameScore.Score_2_0: sRet = "2 : 0"; break; case GameScore.Score_0_2: sRet = "0 : 2"; break; case GameScore.Score_2_1: sRet = "2 : 1"; break; case GameScore.Score_1_2: sRet = "1 : 2"; break; default: break; } return sRet; }
void Awake() { DontDestroyOnLoad(this); secretsFound = new List<int>(); completedLevels = new List<string>(); if (!instance) { instance = this; } LoadFromString(); saveOnExit = true; }
UiResultRow AddOrGetView(PlayerData player, GameScore score) { if (!Views.ContainsKey(player)) { var view = List.AddItem(score, RowPrototype); view.PlayerName.text = player.Name; Views.Add(player, view); } return Views[player]; }
partial void UpdateGameScore(GameScore instance);
//public GUISkin skin; // Use this for initialization void Start() { touch = false; touchImage = GameObject.Find ("Panel").transform.Find("TouchImage").gameObject; gamescore = GameObject.FindWithTag("GameController").GetComponent<GameScore>(); touchParticle = GameObject.Find("UIParticle/touch_effect"); }
void Start() { score = (GameScore) GameObject.Find("Town").GetComponent("GameScore"); }
// Use this for initialization void Start() { gamescore = GetComponent<GameScore>(); gamescore.GameResult(); }
public void OnApplicationQuit() { s_Instance = null; }
void OnApplicationQuit() { instance = null; }