Example #1
0
    void OnMouseDown()
    {
        Vector2    selectedDefenderPos = SnapToGrid(CalculateWorldPointOfMouseClick());
        GameObject defender            = Button.selectedDefender;

        int defenderCost = defender.GetComponent <Defender>().starCost;

        if (starDisplay.Use(defenderCost) == UIDisplay.Status.SUCCESS)
        {
            SpawnDefender(selectedDefenderPos, defender);
        }
        else
        {
            Debug.Log("Insufficient stars to spawn");
        }
    }