コード例 #1
0
    public void ReplaceRandom(BigBattle.Random newValue)
    {
        var index     = ClientComponentsLookup.Random;
        var component = (BigBattle.RandomComponent)CreateComponent(index, typeof(BigBattle.RandomComponent));

        component.value = newValue;
        ReplaceComponent(index, component);
    }
コード例 #2
0
    public void AddRandom(BigBattle.Random newValue)
    {
        var index     = ServerComponentsLookup.Random;
        var component = (BigBattle.RandomComponent)CreateComponent(index, typeof(BigBattle.RandomComponent));

        component.value = newValue;
        AddComponent(index, component);
    }
コード例 #3
0
    public ClientEntity SetRandom(BigBattle.Random newValue)
    {
        if (hasRandom)
        {
            throw new Entitas.EntitasException("Could not set Random!\n" + this + " already has an entity with BigBattle.RandomComponent!",
                                               "You should check if the context already has a randomEntity before setting it or use context.ReplaceRandom().");
        }
        var entity = CreateEntity();

        entity.AddRandom(newValue);
        return(entity);
    }
コード例 #4
0
    public void ReplaceRandom(BigBattle.Random newValue)
    {
        var entity = randomEntity;

        if (entity == null)
        {
            entity = SetRandom(newValue);
        }
        else
        {
            entity.ReplaceRandom(newValue);
        }
    }