/** * This method progresses through the dfa state given a wire that got cut. * * @param wire - is the wire object that got cut */ public void Traverse(GameObject wire) { currentPosition.IsCurrent = false; currentPosition = currentPosition.NextNode(wire.GetComponent <DFAWire>().color); if (currentPosition == null) { GameOver(); } else { currentPosition.IsCurrent = true; if (currentPosition == endNode) { LevelWon(); } } }
/** * This method progresses through the dfa state given a wire that got cut. * * @param wire - is the wire object that got cut */ public void Traverse(GameObject wire) { if (uiManager.GetState() == UIStateManager.UIStates.GAME) { currentPosition.IsCurrent = false; currentPosition = currentPosition.NextNode(wire.GetComponent <BombWire>().color); if (currentPosition == null) { GameOver(); } else { currentPosition.IsCurrent = true; if (currentPosition == endNode) { LevelWon(); } } } }
public IEnumerator NextNodeTest() { var gameObject = new GameObject(); DFANode node1 = gameObject.AddComponent(typeof(DFANode)) as DFANode; var nextNode = node1.NextNode("red"); yield return(null); Assert.AreEqual(nextNode, null); }