Score Class

Summary

A simple scoring system with a high score and Weaver.Examples.FloatingText to indicate when points are gained.
Assembly
Weaver.dll
Namespace
Weaver.Examples
Base Types
  • MonoBehaviour
graph BT Type-->Base0["MonoBehaviour"] Type["Score"] class Type type-node

Syntax

public sealed class Score : MonoBehaviour

Events

Name Type Summary
OnPointsChanged Action
A callback which is triggered whenever the current score changes.
static

Fields

Name Constant Value Summary
Text
An Weaver.ObjectPool`1 made from an injected Weaver.Examples.FloatingText prefab which is used for indicating score gains.
static

Properties

Name Value Summary
HighScore int
The highest store that has been achieved.

This property uses the Weaver.PrefAttribute to automatically save its value in UnityEngine.PlayerPrefs using its full name as the key: "Weaver.Examples.Score.HighScore".
static
Points int
The current score.
static
ScoreText Text
The UI text component used to display the score.

Methods

Name Value Summary
AddPoints(int, Vector3) void
Adds to the current Weaver.Examples.Score.Points and shows a Weaver.Examples.FloatingText to indicate the increase.
static