Exemple #1
0
 public void Rotate(int dir) //+1 to rotate right, -1 to rotate left
 {
     if (dir > 0)            //if we're rotating right
     {
         myInputs  = rotateRight(myInputs);
         myOutputs = rotateRight(myOutputs);
         //   Debug.Log(myInputs.Count);
         myMesh.transform.Rotate(Vector3.up, 90f);
     }
     else if (dir < 0) //if we're rotating left
     {
         myInputs  = rotateLeft(myInputs);
         myOutputs = rotateLeft(myOutputs);
         myMesh.transform.Rotate(Vector3.up, -90f);
     }
     else //if somebody f****d up the input
     {
         return;
     }
     StopNeighbors();
     myNeighbors.Clear();
     MyNeighborOutPut.Clear();
     // this.Init();
     myState = runningState.notRunning;
     ManageAnimator();
 }
Exemple #2
0
    public void ManageAnimator()
    {
        animState = myState;

        //if (myAnimator != null)
        //{
        //   myAnimator.setAnimState(this);
        //}
    }
Exemple #3
0
 public void StopRunning()
 {
     animState = runningState.notRunning;
     myState   = runningState.notRunning;
     //animColor = streamColor.notSet;
     if (myStream != null)
     {
         StreamPool.returnStream(myStream);
         myStream = null;
     }
     ManageAnimator();
 }
Exemple #4
0
    public void PassStream()
    {
        //   Debug.Log(this.transform.name + "Is passing OBJ");

        myNeighbors.Clear();
        MyNeighborOutPut.Clear();
        for (int output = 0; output < myOutputs.Count; output++)
        {
            // Debug.Log(myOutputs[output]);
            if (myParent.GetNeighbor(myOutputs[output]) != null)
            {
                if (myInputs.Contains(myOutputs[output]))
                {
                    myInputs.Remove(myOutputs[output]);
                }
                myNeighbors.Add(myParent.GetNeighbor(myOutputs [output]));
                MyNeighborOutPut.Add(myOutputs [output]);
                // .ReceiveStream(myStream, myOutputs[output]);

                // return;
            }
        }
        //Debug.Log (myStream.currentValue);
        //myStream.currentValue = myStream.currentValue / myNeighbors.Count + 1;
        //Debug.Log (myStream.currentValue + " : " + myNeighbors.Count);
        if (myNeighbors.Count > 0)
        {
            myState = runningState.running;
            for (int neighbor = 0; neighbor < myNeighbors.Count; neighbor++)
            {
                myNeighbors [neighbor].ReceiveStream(myStream, MyNeighborOutPut [neighbor]);
            }
        }
        else
        {
            StreamPool.returnStream(this.Stream);
            myState = runningState.incorrectOutput;
        }
        ManageAnimator();
    }