public void Clear() { SpeedModifier = 1.0f; Loft = 0.0f; Strength = 0.0f; CreatableId = Guid.Empty; Pronoun = PronounModifier.Pronouns.None; Reset = ResetModifier.Resets.None; Color = Classification.Colors.None; Pitch = PitchModifier.PitchDirections.None; Turn = TurnModifier.TurnDirections.None; Make = MakeObjectModifier.MakeObjects.None; Item = ObjectModifier.ModifierObjects.None; TaskId = TaskModifier.TaskIds.SIZEOF; Direction = Programming.Directions.None; Facial = Face.FaceState.NotApplicable; ExpressEmitter = ExpressModifier.Emitters.NotApplicable; Verb = GameThing.Verbs.None; MissileBehavior = MissileChassis.BehaviorFlags.TerrainFollowing; Constraints = ConstraintModifier.Constraints.None; SoundUpid = String.Empty; Points = 0; PlayerIndex = GamePadSensor.PlayerId.Dynamic; ScoreBucket = ScoreBucket.NotApplicable; }
static Scoreboard() { for (ScoreBucket bucket = ScoreBucket.ColorFirst; bucket <= ScoreBucket.ScoreZ; ++bucket) { Score score = new Score(); scores.Add((int)bucket, score); } }
public ScoreSet() { scores = new Dictionary <int, Score>(); for (ScoreBucket bucket = ScoreBucket.ScoreA; bucket <= ScoreBucket.ScoreZ; ++bucket) { Score score = new Score(); scores.Add((int)bucket, score); } } // end of c'tor
/// <summary> /// Resets some or all properties of the score corresponding to the given bucket. /// </summary> /// <param name="bucket"></param> /// <param name="flags"></param> public static void ResetScore(ScoreBucket bucket, ScoreResetFlags flags) { if (bucket == ScoreBucket.NotApplicable) { Reset(flags); } else if (scores.ContainsKey((int)bucket)) { scores[(int)bucket].Reset(flags); } }
/// <summary> /// This function will Register any objects that should be registered when used by a reflex. /// /// This is used by things like the scores and GUI buttons which only appear onscreen /// when used in an actor's kode. /// </summary> internal void RegisterReflexSupportedObject() { for (int i = 0; i < tasks.Count; ++i) { Task task = tasks[i]; for (int j = 0; j < task.reflexes.Count; ++j) { Reflex reflex = task.reflexes[j] as Reflex; //Register Score Bucket if (reflex.Actuator != null && reflex.Actuator.Categories.Get((int)BrainCategories.DoSetScore)) { ScoreBucket bucket = Modifier.ScoreBucketFromModifierSet(reflex.Modifiers); if (bucket != ScoreBucket.NotApplicable) { Scoreboard.Activate(bucket); } } //Register Color Touch Button foreach (Filter filter in reflex.Filters) { if (filter is GUIButtonFilter) { Classification.Colors eColor = (filter as GUIButtonFilter).color; if (eColor >= (Classification.Colors)Classification.ColorInfo.First && eColor <= (Classification.Colors)Classification.ColorInfo.Last) { Debug.Assert(null != GUIButtonManager.GetButton(eColor)); GUIButtonManager.GetButton(eColor).Active = true; } } } } } }
/// <summary> /// Activate a particular register. /// </summary> /// <param name="color"></param> public static void Activate(ScoreBucket bucket) { scores[(int)bucket].Active = true; }
/// <summary> /// Set the current value of a score. /// </summary> /// <param name="bucket">The bucket of the score register</param> /// <param name="value">The value the score should become</param> /// <param name="targetThing">The thing from which the score effect should originate</param> public static void SetScore(ScoreBucket bucket, int value, GameThing targetThing) { Score score = scores[(int)bucket]; score.Curr = value; int delta = score.Curr - score.Prev; if (delta != 0) { GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice; if (score.Visibility == ScoreVisibility.Loud && IsColorBucket(bucket)) { if (delta > 0) { Foley.PlayScore(null); } else { Foley.PlayScoreDown(null); } if (targetThing != null && !(targetThing is NullActor)) { ScoreEffect scoreEffect = AllocScoreEffect(); scoreEffect.thing = targetThing; scoreEffect.thingPosition = targetThing.Movement.Position; scoreEffect.thingBoundingRadius = targetThing.BoundingSphere.Radius; scoreEffect.color = (Classification.Colors)bucket; scoreEffect.start = scoreEffect.curr = targetThing.Movement.Position + targetThing.BoundingSphere.Center + new Vector3(0, 0, targetThing.BoundingSphere.Radius); scoreEffect.end = scoreEffect.start + new Vector3(0, 0, kFloatUpHeight); scoreEffect.alpha = 1f; setScoreCrtList.Clear(); /* * // Convert score delta to chars without creating a temporary string so that we don't * // create junk to be garbage collected (preserving XBOX perf on score-heavy levels). * * if (delta > 0) * setScoreCrtList.Add(charRenderTargets['+']); * else if (delta < 0) * setScoreCrtList.Add(charRenderTargets['-']); * * delta = Math.Abs(delta); * delta = Math.Min(delta, 1000); * * int thou = (delta % 10000) / 1000; * int hund = (delta % 1000) / 100; * int tens = (delta % 100) / 10; * int ones = (delta % 10); * * if (thou > 0) * setScoreCrtList.Add(charRenderTargets[(char)('0' + thou)]); * if (hund > 0 || thou > 0) * setScoreCrtList.Add(charRenderTargets[(char)('0' + hund)]); * if (tens > 0 || hund > 0 || thou > 0) * setScoreCrtList.Add(charRenderTargets[(char)('0' + tens)]); * * setScoreCrtList.Add(charRenderTargets[(char)('0' + ones)]); * */ // Not as memory clean but overcomes the limitations. // Score values are no longer limited to +- 1000 // We don't throw when exceeding max int. string deltaStr = delta.ToString(); setScoreCrtList.Clear(); foreach (char c in deltaStr) { setScoreCrtList.Add(charRenderTargets[c]); } scoreEffect.crts = setScoreCrtList.ToArray(); QueueLoudEffect(scoreEffect); } else { ScoreEffect scoreEffect = AllocScoreEffect(); scoreEffect.color = (Classification.Colors)bucket; QueueQuietEffect(scoreEffect); } } else if (score.Visibility == ScoreVisibility.Quiet) { ScoreEffect scoreEffect = AllocScoreEffect(); scoreEffect.color = (Classification.Colors)bucket; QueueQuietEffect(scoreEffect); } } }
public static bool IsColorBucket(ScoreBucket bucket) { return(bucket >= ScoreBucket.ColorFirst && bucket <= ScoreBucket.ColorLast); }
/// <summary> /// Get the value of the score in the previous frame. /// </summary> /// <param name="bucket"></param> /// <returns></returns> static int GetPrevGlobalScore(ScoreBucket bucket) { return(scores[(int)bucket].Prev); }
/// <summary> /// Get the current value of a score. /// </summary> /// <param name="bucket"></param> /// <returns></returns> public static int GetGlobalScore(ScoreBucket bucket) { return(scores[(int)bucket].Curr); }
/// <summary> /// Set the current value of a score. /// </summary> /// <param name="bucket">The bucket of the score register</param> /// <param name="value">The value the score should become</param> public void SetScore(ScoreBucket bucket, int value) { Score score = scores[(int)bucket]; score.Curr = value; } // end of SetScore()
/// <summary> /// Get the value of the score in the previous frame. /// </summary> /// <param name="bucket"></param> /// <returns></returns> public int GetPrevScore(ScoreBucket bucket) { return(scores[(int)bucket].Prev); }
} // end of Snapshot() /// <summary> /// Get the current value of a score. /// </summary> /// <param name="bucket"></param> /// <returns></returns> public int GetScore(ScoreBucket bucket) { return(scores[(int)bucket].Curr); }
private void Start() { isScoreSet = true; scoreBucketInScene = FindObjectOfType <ScoreBucket>(); }