Exemplo n.º 1
0
    void FixedUpdate()
    {
        if (inMenu)
        {
            return;
        }

        // Disable raycasts if we're inside our tool panel
        if (!RectTransformUtility.RectangleContainsScreenPoint(BuildingPanel, new Vector2(
                                                                   Input.mousePosition.x, Input.mousePosition.y), _cam))
        {
            DoBuildLogic();
        }
        else
        {
            doBuild = false;

            if (lastPlatformHighlight != null)
            {
                lastPlatformHighlight.SetActive(false);
            }

            if (lastHighlight != null)
            {
                lastHighlight.Hide();
            }
        }

        // Update UI
        MoneyLabel.text = "$ " + Money;

        // Change color of the highlighted platform we want to build
        // to whether or not we have enough money
        if (lastPlatformHighlight != null)
        {
            platformRenderer.material.color = Money >= PlatformCost ? Color.green : Color.red;
        }
    }