Example #1
0
        public void Build(bool isUpgrade = false)
        {
            if (!isUpgrade)
            {
                constructState = _ConstructState.Build;
                AudioManager.OnBuildStart();
                AudioManager.PlaySound(soundBuilding);
            }
            else
            {
                constructState = _ConstructState.Upgrade;
                AudioManager.OnUpgradeStart();
                AudioManager.PlaySound(soundUpgrading);
            }

            float buildDuration = GetBuildDuration(level + (isUpgrade ? 1 : 0));

            constructDuration = buildDuration;
            constructRemained = buildDuration;

            effectBuilding.Spawn(GetPos(), Quaternion.identity);

            AnimPlayConstruct();

            TDTK.OnTowerConstructing(this);
        }
Example #2
0
        public void Sell()
        {
            if (disableSelling)
            {
                return;
            }
            constructState    = _ConstructState.Sell;
            constructDuration = statsList[level].sellDuration;
            constructRemained = statsList[level].sellDuration;

            effectBuilding.Spawn(GetPos(), Quaternion.identity);
            AudioManager.PlaySound(soundSold);

            AnimPlayDeconstruct();

            AudioManager.OnTowerSold();
            TDTK.OnTowerConstructing(this);
        }