Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0) && selected &&
            GUIUtility.hotControl == 0 && ship.IsOwner(GameContext.CurrentPlayer))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                //clicked the ship
                if (hit.transform == transform)
                {
                }
            }
            else
            {
                Vector3 newPosition = ray.GetPoint(-Camera.main.transform.position.z);
                newPosition.z = 0;
                ship          = PlayerFleet.UpdateShipDestination(ship, newPosition);
            }
        }
    }