Exemple #1
0
    public void start()
    {
        GenericUpdateData d = TubeSimulate.generic[0].genericUpdateData[idxInUpdateArray];

        d.timeLeft = timeToMakeOne;
        TubeSimulate.generic[0].genericUpdateData[idxInUpdateArray] = d;
    }
Exemple #2
0
    public bool push(ushort itemId)
    {
        //Debug.Log("receives " + itemId);
        for (int i = 0; i < DefaultArraySize; ++i)
        {
            if (srcIds[i] == itemId)
            {
                srcCurrent[i]++;
            }
        }
        if (allMet() == false)
        {
            return(false);
        }

        GenericUpdateData d = TubeSimulate.generic[1].genericUpdateData[idxInUpdateArray];

        if (d.timeLeft > 0.0f)
        {
            return(false);
        }
        Debug.Log("converter starts!");
        //for (int i = 0; i < DefaultArraySize; ++i) {
        //    srcCurrent[i] = 0;
        //}

        startUpdate();
        return(true);
    }
Exemple #3
0
    public void startUpdate()
    {
        clearCurrent();
        GenericUpdateData d = TubeSimulate.generic[1].genericUpdateData[idxInUpdateArray];

        d.timeLeft = timeToMakeOne;
        TubeSimulate.generic[1].genericUpdateData[idxInUpdateArray] = d;
    }
Exemple #4
0
    public void unblock()
    {
        GenericUpdateData d = TubeSimulate.generic[1].genericUpdateData[idxInUpdateArray];

        if (d.timeLeft >= 0.0f)
        {
            return;
        }
    }
Exemple #5
0
    public void unblock()
    {
        GenericUpdateData d = TubeSimulate.generic[0].genericUpdateData[idxInUpdateArray];

        if (d.timeLeft <= 0.0f)
        {
            start();
        }
    }
Exemple #6
0
    // Update is called once per frame
    void Update()
    {
        GenericUpdateData gud = TubeSimulate.generic[1].genericUpdateData[converterId];

        timeLeft = gud.timeLeft;
        ConverterData convDat = TubeSimulate.self.getConverterData(converterId);

        for (int i = 0; i < current.Length; ++i)
        {
            current[i] = convDat.srcCurrent[i];
        }
    }
Exemple #7
0
    public void Execute(int index)
    {
        GenericUpdateData thisData = dataArray[index];

        if (thisData.timeLeft <= 0.0f)
        {
            outputOps[index] = 0;
        }
        else
        {
            thisData.timeLeft -= deltaTime;

            dataArray[index] = thisData;
            outputOps[index] = (thisData.timeLeft <= 0.0f) ? (byte)1 : (byte)0;
        }
    }