Exemple #1
0
    public GameEntity ReplacePhysics(Assets.Code.Services.IPhysicsService newValue)
    {
        var index     = GameComponentsLookup.Physics;
        var component = (Assets.Code.Components.Physics)CreateComponent(index, typeof(Assets.Code.Components.Physics));

        component.Value = newValue;
        ReplaceComponent(index, component);
        return(this);
    }
Exemple #2
0
    public GameEntity SetPhysics(Assets.Code.Services.IPhysicsService newValue)
    {
        if (hasPhysics)
        {
            throw new Entitas.EntitasException("Could not set Physics!\n" + this + " already has an entity with Assets.Code.Components.Physics!",
                                               "You should check if the context already has a physicsEntity before setting it or use context.ReplacePhysics().");
        }
        var entity = CreateEntity();

        entity.AddPhysics(newValue);
        return(entity);
    }
Exemple #3
0
    public void ReplacePhysics(Assets.Code.Services.IPhysicsService newValue)
    {
        var entity = physicsEntity;

        if (entity == null)
        {
            entity = SetPhysics(newValue);
        }
        else
        {
            entity.ReplacePhysics(newValue);
        }
    }