Ejemplo n.º 1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            // Escape key pressed, cancel any current mouse mode
            SelectedUnit = null;
            CancelUpdateFunc();
        }
        hexUnderMouse = MouseToHex();

        Update_CurrentFunc();

        Update_ScrollZoom();

        lastMousePosition = Input.mousePosition;
        lastHexUnderMouse = hexUnderMouse;


        // draw unit path
        if (SelectedUnit != null)
        {
            DrawPath((hexPath != null) ? hexPath : SelectedUnit.GetHexPath());
        }
        else
        {
            DrawPath(null);
        }
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        hexUnderMouse = MouseToHex();

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            //Cancel anaything
            SelectedUnit = null;
            CancelUpdateFunc();
        }

        Update_CurrentFunc();

        lastMousePosition = Input.mousePosition;
        hexLastUnderMouse = hexUnderMouse;

        if (SelectedUnit != null && SelectedUnit.IsDestroyed)
        {
            //We are pointing to a destroyed object
            SelectedUnit = null;
        }

        if (SelectedCity != null && SelectedCity.IsDestroyed)
        {
            //We are pointing to a destroyed object
            SelectedCity = null;
        }

        if (SelectedUnit != null)
        {
            // draw a path
            DrawPath((hexPath != null) ? hexPath : SelectedUnit.GetHexPath());
        }
        else
        {
            DrawPath(null);    //Clear the drawn path on screen
        }
    }