/// <summary> /// Adds an amount of points to the player's score, with a bonus based on the points scored using the <see cref="bonusCurve"/>. /// </summary> /// <param name="points"></param> public void AddScore(ulong points) { float bonus = bonusCurve.Evaluate(Convert.ToSingle(points)); points = Convert.ToUInt64(points + bonus); score += points; if ((points > 3) && (largeScoreAmount != null)) { AudioSource.PlayClipAtPoint(largeScoreAmount, Vector3.zero, 4); } scoreText.text = score.ToString(); ScoreChangedHandler.Invoke(points); }
public void SubscribeToScoreChanged(IGameObject objectOfInterest, ScoreChangedHandler scoreChangedDelegate) { if (!scoreChangedSubscribers.ContainsKey(objectOfInterest.GUID)) scoreChangedSubscribers.Add(objectOfInterest.GUID, new List<ScoreChangedHandler>()); scoreChangedSubscribers[objectOfInterest.GUID].Add(scoreChangedDelegate); }