예제 #1
0
    private void OnMouseOver()
    {
        if (EventSystem.current.IsPointerOverGameObject() || !canBeBuild)
        {
            return;
        }

        if (GameManager.Instance.toolToBuild != null && currentObject == null)
        {
            spr.color = targetColor;

            // build
            if (Input.GetMouseButtonDown(0))
            {
                if (ShopSystem.CanBuild())
                {
                    PlaceTool();
                }
                else
                {
                    shake.CameraShake();
                    // Show not enought money UI
                    shake.ShowNotEnoughMoney();
                    // sound
                    AudioManager.Play(Sound.MoneyNotEnoughSound);
                }
            }
            else
            {
                return;
            }
        }
        return;
    }