public async Task <PlayerScoring> GetPlayerScoringAsync(string playerId) { ScoringDto scoringDto = await _context.Scorings.FindAsync(playerId); PlayerScoring scoring; if (scoringDto != null) { scoring = new PlayerScoring { PlayerId = scoringDto.PlayerId, Score = scoringDto.Score, CompletedMilestoneIndices = scoringDto.CompletedMilestoneIndices?.Split(',').Select(m => int.Parse(m)) ?? Enumerable.Empty <int>() } } ; else { scoring = new PlayerScoring { PlayerId = playerId }; } return(scoring); }
void Awake() { scoring = GetComponent <PlayerScoring>(); shooting = GetComponent <PlayerShooting>(); movement = GetComponent <PlayerMovement>(); vfx = GetComponent <PlayerVFX>(); }
void Awake() { m_score = GameObject.Find("In_Game_UI").GetComponent <PlayerScoring> (); m_scoreText = GameObject.Find("Score Is").GetComponent <Text> (); m_startButton = GameObject.Find("Game_Start_Menu").GetComponent <Start_Button> (); gameObject.SetActive(false); }
void Start() { m_balloonPool = GetComponent <Balloon_Object_Pool>(); m_statChange = GameObject.Find("Game_Start_Menu").GetComponent <StatChange_Sliders>(); m_scorer = GameObject.Find("In_Game_UI").GetComponent <PlayerScoring> (); m_gameUI = GameObject.Find("In_Game_UI").GetComponent <InGameUI> (); }
public void CollectOrb(PlayerScoring playerScoring) { int pointValue = playerScoring.AddOrb(); OrbSFXManager.PlayOrbPickUpSound(); Destroy(gameObject); OrbManager.Place3DText(transform.position, pointValue); }
public async Task <IActionResult> GetProgressAsync([FromBody] ProgressQueryViewModel progressQuery) { // defensive code GuardClause(ModelState, progressQuery); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // get the quest configuration QuestConfiguration questConfiguration = await _questRepository.GetQuestAsync(); // get current score PlayerScoring playerScoring = await _playerScoringRepository.GetPlayerScoringAsync(progressQuery.PlayerId); decimal totalQuestPointAccumulated = playerScoring.Score + (progressQuery.ChipAmountBet * questConfiguration.RateFromBet) + (progressQuery.PlayerLevel * questConfiguration.LevelBonusRate); // new milestones reached? IEnumerable <Milestone> newCompletedMilestones = questConfiguration.Milestones .Where(m => !playerScoring.CompletedMilestoneIndices.Contains(m.MilestoneIndex) && // non completed yet m.PointsNeededToComplete <= totalQuestPointAccumulated // new milestone achieved ); // upsert the user's score and new completed milestones player score await _playerScoringRepository.UpsertPlayerScoringAsync( progressQuery.PlayerId, totalQuestPointAccumulated, newCompletedMilestones?.Select(m => m.MilestoneIndex) ?? Enumerable.Empty <int>()); return(Ok(new ProgressViewModel { QuestPointsEarned = totalQuestPointAccumulated, TotalQuestPercentCompleted = totalQuestPointAccumulated / questConfiguration.TotalPointNeededToComplete * 100, MilestonesCompleted = questConfiguration.Milestones .Where(m => playerScoring.CompletedMilestoneIndices.Contains(m.MilestoneIndex)) // already completed milestones .Concat(newCompletedMilestones) .Select(m => new MilestoneViewModel { MilestoneIndex = m.MilestoneIndex, ChipsAwarded = m.ChipAwarded }) })); }
public override void SimulateOwner() { var speed = 0f; var movementValue = 10f; var rotationSpeed = 180f; var rotation = Vector3.zero; if (Input.GetKey(KeyCode.Z)) { speed += movementValue; } if (Input.GetKey(KeyCode.S)) { speed -= movementValue; } if (Input.GetKey(KeyCode.Q)) { rotation.y -= 1; } if (Input.GetKey(KeyCode.D)) { rotation.y += 1; } if (entity.isOwner && _canAttack) { if (Input.GetKeyDown(KeyCode.Space)) { _canAttack = false; state.IsAttacking = true; var updateScore = PlayerScoring.Create(); updateScore.PlayerIndex = PlayerId; updateScore.Send(); StartCoroutine(CancelIsAttacking()); } } if (speed != 0) { transform.position = transform.position + (transform.forward * speed * BoltNetwork.frameDeltaTime); } if (rotation != Vector3.zero) { transform.Rotate(rotation * rotationSpeed * BoltNetwork.frameDeltaTime); } }
public void LoadGameData() { string filePath = Application.dataPath + gameDataFileName; if (File.Exists(filePath)) { string dataAsJson = File.ReadAllText(filePath); PlayerScoring loadedData = JsonUtility.FromJson <PlayerScoring>(dataAsJson); playerScoring.highScore = loadedData.highScore; //Debug.Log (playerScoring.highScore); } else { string dataAsJson = JsonUtility.ToJson(playerScoring); File.WriteAllText(filePath, dataAsJson); } }
public string getTop5PlayersText(MultiplayerManagement gameManager) { PlayerScoring[] players = new PlayerScoring[MultiplayerManagement.players.Count]; int pIndex = 0; foreach (PlayerMain player in MultiplayerManagement.players) { players[pIndex++] = player.scoring; } System.Array.Sort(players, (x, y) => y.score - x.score); int minPlayerCount = Mathf.Min(MultiplayerManagement.players.Count, 5); string leaderBoardText = "High Scores "; for (int i = 0; i < minPlayerCount; i++) { leaderBoardText += string.Format("<color={0}>Player {1}</color> ({2}) | ", ColorTypeConverter.ToRGBHex(players[i].main.playerColor), players[i].main.playerNumber + 1, (players[i].score * 10).ToString("F0")); } return(leaderBoardText); }
// Use this for initialization void Start() { DontDestroyOnLoad(gameObject); playerScoring = new PlayerScoring(); LoadGameData(); }
void Awake() { m_movement = new Vector3(0.0f, 1.0f, 0.0f); m_scoring = GameObject.Find("In_Game_UI").GetComponent <PlayerScoring> (); m_transform = GetComponent <Transform> (); }
public override void OnEvent(PlayerScoring evnt) { UpdateScore(evnt.PlayerIndex); }