logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityGameSessionService

    Unity MonoBehaviour implementation of IGameSessionService.

    Inheritance
    object
    UnityGameSessionService
    Implements
    IGameSessionService
    IService
    IFoundationSettings
    Namespace: Serenity.GameSession.Infrastructure.Services
    Assembly: Serenity.UnityGameSession.Infrastructure.dll
    Syntax
    public class UnityGameSessionService : MonoBehaviour, IGameSessionService, IService, IFoundationSettings
    Remarks

    Delegates session state management to GameSessionState and reads elapsed time from an injected ITimer.

    Constructors

    UnityGameSessionService()

    Declaration
    public UnityGameSessionService()

    Fields

    LOG_CATEGORY

    Declaration
    protected const string LOG_CATEGORY = "GameSessionService"
    Field Value
    Type Description
    string

    _guid

    Declaration
    protected string _guid
    Field Value
    Type Description
    string

    _id

    Declaration
    protected string _id
    Field Value
    Type Description
    string

    _logService

    Declaration
    protected ILogService _logService
    Field Value
    Type Description
    ILogService

    _previousTimeSourceSeconds

    Declaration
    protected float _previousTimeSourceSeconds
    Field Value
    Type Description
    float

    _state

    Declaration
    protected GameSessionState _state
    Field Value
    Type Description
    GameSessionState

    _timeSource

    Declaration
    protected ITimer _timeSource
    Field Value
    Type Description
    ITimer

    Properties

    ElapsedTime

    Declaration
    public float ElapsedTime { get; }
    Property Value
    Type Description
    float

    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

    SessionId

    Declaration
    public GameSessionId SessionId { get; }
    Property Value
    Type Description
    GameSessionId

    Status

    Declaration
    public GameSessionStatus Status { get; }
    Property Value
    Type Description
    GameSessionStatus

    Methods

    Complete()

    Declaration
    public virtual void Complete()

    ConfigureTimer(ITimer)

    Declaration
    public virtual void ConfigureTimer(ITimer timer)
    Parameters
    Type Name Description
    ITimer timer

    GameOver()

    Declaration
    public virtual void GameOver()

    GetSnapshot()

    Declaration
    public virtual GameSessionSnapshot GetSnapshot()
    Returns
    Type Description
    GameSessionSnapshot

    InitializeService(ILogService)

    Initializes the service with required dependencies.

    Declaration
    public virtual void InitializeService(ILogService logService)
    Parameters
    Type Name Description
    ILogService logService

    The logging service for diagnostic output.

    Pause()

    Declaration
    public virtual void Pause()

    Resume()

    Declaration
    public virtual void Resume()

    StartSession(GameSessionId)

    Declaration
    public virtual void StartSession(GameSessionId sessionId)
    Parameters
    Type Name Description
    GameSessionId sessionId

    Tick()

    Declaration
    public virtual void Tick()

    Implements

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