public void ReplaceRocketConfig(RocketConfig newValue)
    {
        var index     = GameComponentsLookup.RocketConfig;
        var component = (RocketConfigComponent)CreateComponent(index, typeof(RocketConfigComponent));

        component.Value = newValue;
        ReplaceComponent(index, component);
    }
    public GameEntity SetRocketConfig(RocketConfig newValue)
    {
        if (hasRocketConfig)
        {
            throw new Entitas.EntitasException("Could not set RocketConfig!\n" + this + " already has an entity with RocketConfigComponent!",
                                               "You should check if the context already has a rocketConfigEntity before setting it or use context.ReplaceRocketConfig().");
        }
        var entity = CreateEntity();

        entity.AddRocketConfig(newValue);
        return(entity);
    }
    public void ReplaceRocketConfig(RocketConfig newValue)
    {
        var entity = rocketConfigEntity;

        if (entity == null)
        {
            entity = SetRocketConfig(newValue);
        }
        else
        {
            entity.ReplaceRocketConfig(newValue);
        }
    }
Beispiel #4
0
 public void Initialize(RocketConfig config)
 {
     Config            = config;
     _rigidbody2D      = GetComponent <Rigidbody2D>();
     _rigidbody2D.mass = Config.Mass;
 }