Exemple #1
0
    public void Toggle()
    {
        if (toggle == LinkType.on)
        {
            GetComponent <Image>().sprite = toggleOff;
            toggle = LinkType.off;
        }
        else if (toggle == LinkType.off)
        {
            GetComponent <Image>().sprite = toggleOff;
            toggle = LinkType.on;
        }
        BuildingBase building = linkingTower.GetComponent <BuildingBase>();

        if (linkingTower != null && toggle == LinkType.over)
        {
            if (building.GetLinksLeft() == 0 && Player.player.hasGold(100))
            {
                Player.player.TakeGold(100);
                building.LevelUp();
                toggle = LinkType.on;
                //building.AddLink(linkingAugment, LinkType.on);
                building.ToggleLink(linkingAugment);
                building.SetLink(linkingAugment, LinkType.on);
                building.ForceUpdate();
                MouseHook.mousehook.UpdateLinks();
                return;
            }
        }
        building.ToggleLink(linkingAugment);
    }