Exemplo n.º 1
0
    void OnMouseDown()
    {
        Vector2    rawPos       = CalcWorldOfMouseClick();
        Vector2    roundedPos   = RoundPosToGrid(rawPos);
        GameObject defender     = Button.selectedDefender;
        int        defenderCost = defender.GetComponent <Defender>().price;

        if (starDisplay.UseStars(defenderCost) == StarDisplay.Status.SUCCESS)
        {
            SpawnDefender(defender, roundedPos);
        }
        else
        {
            //Debug.Log ("Не хватает звезд!");
            starAnimation = starDisplay.GetComponent <Animator> ();
            starAnimation.SetTrigger("notenough");
        }
    }