コード例 #1
0
    public MetaEntity SetInputService(svanderweele.Core.Pieces.Input.Service.IInputService newService)
    {
        if (hasInputService)
        {
            throw new Entitas.EntitasException("Could not set InputService!\n" + this + " already has an entity with svanderweele.Core.Pieces.Input.Service.InputServiceComponent!",
                                               "You should check if the context already has a inputServiceEntity before setting it or use context.ReplaceInputService().");
        }
        var entity = CreateEntity();

        entity.AddInputService(newService);
        return(entity);
    }
コード例 #2
0
    public void ReplaceInputService(svanderweele.Core.Pieces.Input.Service.IInputService newService)
    {
        var entity = inputServiceEntity;

        if (entity == null)
        {
            entity = SetInputService(newService);
        }
        else
        {
            entity.ReplaceInputService(newService);
        }
    }