// If the player loss private void rayCast() { line = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0.5f)); Debug.DrawRay(line.origin, line.direction, Color.cyan); RaycastHit hit; if (Physics.Raycast(line, out hit)) { if (hit.collider.name == boxes[0].name) { player_directions = Directions.Points.UP; } if (hit.collider.name == boxes[1].name) { player_directions = Directions.Points.DOWN; } if (hit.collider.name == boxes[2].name) { player_directions = Directions.Points.RIGHT; } if (hit.collider.name == boxes[3].name) { player_directions = Directions.Points.LEFT; } Debug.Log(hit.collider.ToString()); } }
void randomNumber() { switch (ai_State) { case State.STATE.ROCK_PAPER_SCISSORS: ai_hands = (HandSigns.Signs)Random.Range(0, 2); break; case State.STATE.LOOK_OVER_THERE: ai_points = (Directions.Points)Random.Range(0, 3); break; } }
// Start is called before the first frame update void Start() { // Default Start playerState = State.STATE.ROCK_PAPER_SCISSORS; player_hands = HandSigns.Signs.NONE; player_directions = Directions.Points.NONE; boxes = new GameObject[4]; boxes[0] = new GameObject("Up_Box"); boxes[1] = new GameObject("Down_Box"); boxes[2] = new GameObject("Right_Box"); boxes[3] = new GameObject("Left_Box"); line.origin = transform.position; }
// Start is called before the first frame update void Start() { ai_State = State.STATE.ROCK_PAPER_SCISSORS; ai_hands = HandSigns.Signs.NONE; ai_points = Directions.Points.NONE; }
public void pointLeft() { player_directions = Directions.Points.LEFT; }
public void pointRight() { player_directions = Directions.Points.RIGHT; }
public void pointDown() { player_directions = Directions.Points.DOWN; }
// Public Directions commands for Pointing buttons public void pointUp() { player_directions = Directions.Points.UP; }