public void setNewDirection(Orb orb) { Debug.Log("Moving"); orb.isAnimating = false; switch (direction) { case BoardNode.Direction.kUp: Debug.Log("New Direction: Up"); orb.moveUp(); break; case BoardNode.Direction.kRight: Debug.Log("New Direction: Right"); orb.moveRight(); break; case BoardNode.Direction.kDown: Debug.Log("New Direction: Down"); orb.moveDown(); break; case BoardNode.Direction.kLeft: Debug.Log("New Direction: Left"); orb.moveLeft(); break; } }
public void NodeClicked(BoardNode node) { if (node == null) { currentOrb = null; hideSelection(); return; } if (currentOrb == node) { currentOrb = null; hideSelection(); return; } Orb nodeOrb = node as Orb; if (nodeOrb != null) { currentOrb = nodeOrb; showSelection(currentOrb.transform.position); return; } if (currentOrb != null) { if (node.posX == currentOrb.posX) { if (node.posY > currentOrb.posY) { currentOrb.moveUp(); } else if (node.posY < currentOrb.posY) { currentOrb.moveDown(); } } else if (node.posY == currentOrb.posY) { if (node.posX > currentOrb.posX) { currentOrb.moveRight(); } else if (node.posX < currentOrb.posX) { currentOrb.moveLeft(); } } } currentOrb = null; hideSelection(); }