public void TaskOnClick() { if (isEnabled) { Debug.Log("Button pressed: " + direction.ToString()); nav.VoteForDirection(direction); } }
void OnMouseDown() { // this button was clicked if (isEnabled) { string str = gameObject.name.Substring(6); if (str.Equals("Up")) { nav.VoteForDirection(NavGameController.Direction.Up); } else if (str.Equals("Down")) { nav.VoteForDirection(NavGameController.Direction.Down); } else if (str.Equals("Left")) { nav.VoteForDirection(NavGameController.Direction.Left); } else if (str.Equals("Right")) { nav.VoteForDirection(NavGameController.Direction.Right); } } }