Beispiel #1
0
    public void ReplaceGameDataSetup(GameDataSetup newValue)
    {
        var index     = GameComponentsLookup.GameDataSetup;
        var component = (GameDataSetupComponent)CreateComponent(index, typeof(GameDataSetupComponent));

        component.value = newValue;
        ReplaceComponent(index, component);
    }
Beispiel #2
0
    public GameEntity SetGameDataSetup(GameDataSetup newValue)
    {
        if (hasGameDataSetup)
        {
            throw new Entitas.EntitasException("Could not set GameDataSetup!\n" + this + " already has an entity with GameDataSetupComponent!",
                                               "You should check if the context already has a gameDataSetupEntity before setting it or use context.ReplaceGameDataSetup().");
        }
        var entity = CreateEntity();

        entity.AddGameDataSetup(newValue);
        return(entity);
    }
Beispiel #3
0
    public void ReplaceGameDataSetup(GameDataSetup newValue)
    {
        var entity = gameDataSetupEntity;

        if (entity == null)
        {
            entity = SetGameDataSetup(newValue);
        }
        else
        {
            entity.ReplaceGameDataSetup(newValue);
        }
    }
Beispiel #4
0
    private GameObject MapAsteroidLevelToResource(int level, GameDataSetup setup)
    {
        switch (level)
        {
        case 0:
            return(setup.tinys[Random.Range(0, setup.tinys.Length)]);

        case 1:
            return(setup.smalls[Random.Range(0, setup.smalls.Length)]);

        case 2:
            return(setup.meds[Random.Range(0, setup.meds.Length)]);

        default:
            return(setup.bigs[Random.Range(0, setup.bigs.Length)]);
        }
    }