logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityScoreService

    Unity MonoBehaviour implementation of IScoreService.

    Inheritance
    object
    UnityScoreService
    Implements
    IScoreService
    IService
    IFoundationSettings
    Namespace: Serenity.Score.Infrastructure.Services
    Assembly: Serenity.UnityScore.Infrastructure.dll
    Syntax
    public class UnityScoreService : MonoBehaviour, IScoreService, IService, IFoundationSettings
    Remarks

    Delegates score operations to the ScoreRuntime domain entity and optionally persists snapshots through an IScoreRepository.

    Constructors

    UnityScoreService()

    Declaration
    public UnityScoreService()

    Properties

    Guid

    Declaration
    public string Guid { get; set; }
    Property Value
    Type Description
    string

    Id

    Declaration
    public string Id { get; set; }
    Property Value
    Type Description
    string

    LogService

    Declaration
    public ILogService LogService { get; set; }
    Property Value
    Type Description
    ILogService

    Methods

    Add(ScoreKey, float)

    Declaration
    public void Add(ScoreKey key, float delta)
    Parameters
    Type Name Description
    ScoreKey key
    float delta

    Divide(ScoreKey, float)

    Declaration
    public void Divide(ScoreKey key, float divisor)
    Parameters
    Type Name Description
    ScoreKey key
    float divisor

    GetSnapshot()

    Declaration
    public ScoreSnapshot GetSnapshot()
    Returns
    Type Description
    ScoreSnapshot

    InitializeService(ILogService, IScoreRepository)

    Initializes the service with required dependencies.

    Declaration
    public void InitializeService(ILogService logService, IScoreRepository repository = null)
    Parameters
    Type Name Description
    ILogService logService

    The logging service for diagnostic output.

    IScoreRepository repository

    Optional score repository for persistence.

    Multiply(ScoreKey, float)

    Declaration
    public void Multiply(ScoreKey key, float factor)
    Parameters
    Type Name Description
    ScoreKey key
    float factor

    Register(ScoreKey, ScoreMetricKind)

    Declaration
    public void Register(ScoreKey key, ScoreMetricKind kind)
    Parameters
    Type Name Description
    ScoreKey key
    ScoreMetricKind kind

    ResetAll()

    Declaration
    public void ResetAll()

    ResetKey(ScoreKey)

    Declaration
    public void ResetKey(ScoreKey key)
    Parameters
    Type Name Description
    ScoreKey key

    Set(ScoreKey, float)

    Declaration
    public void Set(ScoreKey key, float value)
    Parameters
    Type Name Description
    ScoreKey key
    float value

    Subtract(ScoreKey, float)

    Declaration
    public void Subtract(ScoreKey key, float delta)
    Parameters
    Type Name Description
    ScoreKey key
    float delta

    TryGetValue(ScoreKey, out ScoreValue)

    Declaration
    public bool TryGetValue(ScoreKey key, out ScoreValue value)
    Parameters
    Type Name Description
    ScoreKey key
    ScoreValue value
    Returns
    Type Description
    bool

    Implements

    IScoreService
    IService
    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved