示例#1
0
    public GameEntity ReplaceIdentifiers(Assets.Code.Services.IIdentifierService newValue)
    {
        var index     = GameComponentsLookup.Identifiers;
        var component = (Assets.Code.Components.Identifiers)CreateComponent(index, typeof(Assets.Code.Components.Identifiers));

        component.Value = newValue;
        ReplaceComponent(index, component);
        return(this);
    }
示例#2
0
    public GameEntity SetIdentifiers(Assets.Code.Services.IIdentifierService newValue)
    {
        if (hasIdentifiers)
        {
            throw new Entitas.EntitasException("Could not set Identifiers!\n" + this + " already has an entity with Assets.Code.Components.Identifiers!",
                                               "You should check if the context already has a identifiersEntity before setting it or use context.ReplaceIdentifiers().");
        }
        var entity = CreateEntity();

        entity.AddIdentifiers(newValue);
        return(entity);
    }
示例#3
0
    public void ReplaceIdentifiers(Assets.Code.Services.IIdentifierService newValue)
    {
        var entity = identifiersEntity;

        if (entity == null)
        {
            entity = SetIdentifiers(newValue);
        }
        else
        {
            entity.ReplaceIdentifiers(newValue);
        }
    }