Пример #1
0
    public static bool Logic(bool inA, bool inB)
    {
        bool out1 = NotG.Logic(inA);
        bool out2 = NotG.Logic(inB);

        return(NandG.Logic(out1, out2));
    }
Пример #2
0
    void Update()
    {
        if (isSimulating && timeCounter >= timeP)
        {
            bool valueA = false;
            bool valueB = false;

            if (counter == 0)
            {
                valueA = false;
                valueB = false;
            }
            else if (counter == 1)
            {
                valueA = false;
                valueB = true;
            }
            else if (counter == 2)
            {
                valueA = true;
                valueB = false;
            }
            else if (counter == 3)
            {
                valueA = true;
                valueB = true;
            }

            inputA.material = valueA? onMat:offMat;
            inputB.material = valueB? onMat : offMat;
            bool outp = NandG.Logic(valueA, valueB);
            Debug.Log("inputA " + valueA + " inputB " + valueB + " output " + outp);
            output.material = outp ? onMat : offMat;

            counter++;

            if (counter >= 4)
            {
                counter = 0;
            }

            timeCounter = 0.0f;
        }
        timeCounter += Time.deltaTime;
    }
Пример #3
0
    public static bool Logic(bool inA, bool inB)
    {
        bool out1 = NandG.Logic(inA, inB);

        return(NotG.Logic(out1));
    }
Пример #4
0
 public static bool Logic(bool inA)
 {
     return(NandG.Logic(inA, inA));
 }