logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityHittableService

    Unity MonoBehaviour implementation of IHittableService. Tracks a dictionary of HittableState instances keyed by HittableId, for non-Character world objects (props, destructibles, reactive scenery).

    Inheritance
    object
    UnityHittableService
    Implements
    IHittableService
    IService
    IFoundationSettings
    Namespace: Serenity.Hittable.Infrastructure.Services
    Assembly: Serenity.UnityHittable.Infrastructure.dll
    Syntax
    public class UnityHittableService : MonoBehaviour, IHittableService, IService, IFoundationSettings

    Constructors

    UnityHittableService()

    Declaration
    public UnityHittableService()

    Fields

    LOG_CATEGORY

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

    _eventDispatcherService

    Declaration
    protected IEventDispatcherService _eventDispatcherService
    Field Value
    Type Description
    IEventDispatcherService

    _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

    _states

    Declaration
    protected Dictionary<HittableId, HittableState> _states
    Field Value
    Type Description
    Dictionary<HittableId, HittableState>

    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

    GetSnapshot(HittableId)

    Declaration
    public virtual HittableSnapshot GetSnapshot(HittableId id)
    Parameters
    Type Name Description
    HittableId id
    Returns
    Type Description
    HittableSnapshot

    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.

    InitializeService(ILogService, IEventDispatcherService)

    Initializes the service with required dependencies and an optional event dispatcher.

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

    The logging service for diagnostic output.

    IEventDispatcherService eventDispatcherService

    Dispatcher this service uses to broadcast HittableHitSignal and HittableDestroyedSignal from TakeHit(HittableId, int). Optional: null skips dispatch (e.g. in a test that only exercises the state-mutating API).

    IsRegistered(HittableId)

    Declaration
    public virtual bool IsRegistered(HittableId id)
    Parameters
    Type Name Description
    HittableId id
    Returns
    Type Description
    bool

    Register(HittableId, int)

    Declaration
    public virtual void Register(HittableId id, int maxHealth)
    Parameters
    Type Name Description
    HittableId id
    int maxHealth

    Reset(HittableId)

    Declaration
    public virtual void Reset(HittableId id)
    Parameters
    Type Name Description
    HittableId id

    TakeHit(HittableId, int)

    Declaration
    public virtual HitOutcome TakeHit(HittableId id, int damage = 1)
    Parameters
    Type Name Description
    HittableId id
    int damage
    Returns
    Type Description
    HitOutcome

    Unregister(HittableId)

    Declaration
    public virtual bool Unregister(HittableId id)
    Parameters
    Type Name Description
    HittableId id
    Returns
    Type Description
    bool

    Implements

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