Exemplo n.º 1
0
    // Ray cast for the Four Directions State
    private void RayCast()
    {
        // Some magic numbers to make sure the Ray is going in the Direction the camera is facing.
        line = cam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0.0f));
        Debug.DrawRay(line.origin, line.direction, Color.white);

        if (Physics.Raycast(line, out hit))
        {
            // The right Collision Box
            if (hit.collider == box_colliders[0])
            {
                player_FD_state = Four_Directions_State.Directions.RIGHT;
            }
            // The left Collision Box
            if (hit.collider == box_colliders[1])
            {
                player_FD_state = Four_Directions_State.Directions.LEFT;
            }
            // The up Collision Box
            if (hit.collider == box_colliders[2])
            {
                player_FD_state = Four_Directions_State.Directions.UP;
            }
            // The down Collision Box
            if (hit.collider == box_colliders[3])
            {
                player_FD_state = Four_Directions_State.Directions.DOWN;
            }
            else
            {
                player_FD_state = Four_Directions_State.Directions.NONE;
            }
        }
    }
Exemplo n.º 2
0
    private void Awake()
    {
        // So no warnings get thrown
        player_FD_state  = Four_Directions_State.Directions.NONE;
        player_RPS_state = Rock_Paper_Scissors.Signs.NONE;
        line.origin      = transform.position;

        turn_controller = GetComponent <Turn_Script>();
    }