public Stun GetStun() { return(PerkManager.ModifyStunWithPerkBonus(stats[currentActiveStat].stun.Clone(), prefabID, 1)); } //pass 1 to indicate this is for FPSWeapon
} //pass 1 to indicate this is for FPSWeapon public Slow GetSlow() { return(PerkManager.ModifySlowWithPerkBonus(stats[currentActiveStat].slow.Clone(), prefabID, 1)); }
// Use this for initialization void Start() { if (!PerkManager.IsOn()) { gameObject.SetActive(false); return; } if (!assignItemManually) { List <Perk> perkList = PerkManager.GetPerkList(); itemList = new List <PerkItem>(); PerkItem item0 = new PerkItem(); item0.button.rootObj = backupItemObj; itemList.Add(item0); int count = 0; float y = 0; for (int i = 0; i < perkList.Count; i++) { if (i == 0) { itemList[0].button.Init(); } else if (i > 0) { PerkItem item = new PerkItem(); item.button = itemList[0].button.Clone("ItemButton" + (count + 1), new Vector3(count * 60, y, 0)); itemList.Add(item); } count += 1; if (count == 8) { count = 0; y -= 60; } itemList[i].button.imageIcon.sprite = perkList[i].icon; itemList[i].perkID = perkList[i].ID; itemList[i].perkIndex = i; if (perkList[i].purchased) { SetToPurchased(itemList[i]); } else if (perkList[i].IsAvailable() != "") { SetToUnavailable(itemList[i]); } else { SetToNormal(itemList[i]); } } scrollViewContent.sizeDelta = new Vector2(500, -y + 60 + Mathf.Abs(itemList[0].button.rootT.localPosition.y)); } else { List <Perk> perkList = PerkManager.GetPerkList(); for (int i = 0; i < itemList.Count; i++) { if (itemList[i].button.rootObj != null) { itemList[i].button.Init(); if (itemList[i].perkID >= 0) { for (int n = 0; n < perkList.Count; n++) { if (perkList[n].ID == itemList[i].perkID) { itemList[i].button.imageIcon.sprite = perkList[n].icon; itemList[i].perkIndex = n; if (perkList[n].purchased) { SetToPurchased(itemList[i]); } else if (perkList[n].IsAvailable() != "") { SetToUnavailable(itemList[i]); } else { SetToNormal(itemList[i]); } break; } } } } } } List <Rsc> rscList = ResourceManager.GetResourceList(); for (int i = 0; i < rscList.Count; i++) { if (i == 0) { rscObjList[i].Init(); } else { rscObjList.Add(rscObjList[0].Clone("RscObj" + i, new Vector3(i * 80, 0, 0))); } rscObjList[i].imageIcon.sprite = rscList[i].icon; } rscObj = rscObjList[0].rootT.parent.gameObject; UpdatePerkPoint(PerkManager.GetPerkPoint()); //select the first item OnItemButton(itemList[0].button.rootObj); menuObj.transform.localPosition = new Vector3(0, 10, 0); _Hide(false); }
public float GetShieldPierce() { return(stats[currentActiveStat].shieldPierce + PerkManager.GetFPSWeaponShieldPierce(prefabID)); }
public float GetAOERadius() { return(aoeRadius * (1 + PerkManager.GetAbilityAOERadius(ID))); }
void Awake() { Time.fixedDeltaTime = timeStep; instance = this; thisT = transform; //ObjectPoolManager.Init(); BuildManager buildManager = (BuildManager)FindObjectOfType(typeof(BuildManager)); buildManager.Init(); NodeGenerator nodeGenerator = (NodeGenerator)FindObjectOfType(typeof(NodeGenerator)); if (nodeGenerator != null) { nodeGenerator.Awake(); } PathFinder pathFinder = (PathFinder)FindObjectOfType(typeof(PathFinder)); if (pathFinder != null) { pathFinder.Awake(); } PathTD[] paths = FindObjectsOfType(typeof(PathTD)) as PathTD[]; for (int i = 0; i < paths.Length; i++) { paths[i].Init(); } for (int i = 0; i < buildManager.buildPlatforms.Count; i++) { buildManager.buildPlatforms[i].Init(); } gameObject.GetComponent <ResourceManager>().Init(); PerkManager perkManager = (PerkManager)FindObjectOfType(typeof(PerkManager)); if (perkManager != null) { perkManager.Init(); } if (loadAudioManager) { Instantiate(Resources.Load("AudioManager", typeof(GameObject))); } if (rangeIndicator) { rangeIndicator = (Transform)ObjectPoolManager.Spawn(rangeIndicator); rangeIndicator.parent = thisT; rangeIndicatorObj = rangeIndicator.gameObject; } if (rangeIndicatorCone) { rangeIndicatorCone = (Transform)ObjectPoolManager.Spawn(rangeIndicatorCone); rangeIndicatorCone.parent = thisT; rangeIndicatorConeObj = rangeIndicatorCone.gameObject; } ClearSelectedTower(); Time.timeScale = 1; }
public int GetClipSize() { return((int)(stats[currentActiveStat].clipSize * (1 + PerkManager.GetFPSWeaponClipSize(prefabID)))); }
public float GetCost() { return(cost * (1 - PerkManager.GetAbilityCost(ID))); }
public float GetDamageMax() { return(Mathf.Max(0, stats[currentActiveStat].damageMax * (1 + PerkManager.GetFPSWeaponDamage(prefabID)))); }
public float GetCooldown() { return(Mathf.Max(0.05f, stats[currentActiveStat].cooldown * (1 + PerkManager.GetFPSWeaponCD(prefabID)))); }
void OnUnitCleared(UnitCreep creep) { int waveID = creep.waveID; activeUnitCount -= 1; Wave wave = null; if (spawnLimit == _SpawnLimit.Finite) { wave = waveList[waveID]; } else if (spawnLimit == _SpawnLimit.Infinite) { for (int i = 0; i < waveList.Count; i++) { if (waveList[i].waveID == waveID) { wave = waveList[i]; break; } } if (wave == null) { Debug.Log("error!"); return; } } wave.activeUnitCount -= 1; if (wave.spawned && wave.activeUnitCount == 0) { wave.cleared = true; waveClearedCount += 1; //Debug.Log("wave"+(waveID+1)+ " is cleared"); ResourceManager.GainResource(wave.rscGainList, PerkManager.GetRscWaveKilled()); GameControl.GainLife(wave.lifeGain + PerkManager.GetLifeWaveClearedModifier()); AbilityManager.GainEnergy(wave.energyGain + (int)PerkManager.GetEnergyWaveClearedModifier()); if (spawnLimit == _SpawnLimit.Infinite) { waveList.Remove(wave); } if (IsAllWaveCleared()) { GameControl.GameWon(); } else { if (spawnMode == _SpawnMode.Round && onEnableSpawnE != null) { onEnableSpawnE(); } } } if (!IsAllWaveCleared() && activeUnitCount == 0 && !spawning) { if (spawnMode == _SpawnMode.WaveCleared) { SpawnWaveFinite(); } } }
private float GetUpgradeCostMultiplier() { return(1 - PerkManager.GetTowerUpgradeCost(prefabID)); }
private float GetBuildCostMultiplier() { return(1 - PerkManager.GetTowerBuildCost(prefabID)); }
public Dot GetDot() { return(PerkManager.ModifyDotWithPerkBonus(stats[currentActiveStat].dot.Clone(), prefabID, 1)); }
public float GetReloadDuration() { return(Mathf.Max(0.05f, stats[currentActiveStat].reloadDuration * (1 + PerkManager.GetFPSWeaponReloadDuration(prefabID)))); }
public InstantKill GetInstantKill() { return(PerkManager.ModifyInstantKillWithPerkBonus(stats[currentActiveStat].instantKill.Clone(), prefabID, 1)); }
public float GetAOERange() { return(stats[currentActiveStat].aoeRadius * (1 + PerkManager.GetFPSWeaponAOERadius(prefabID))); }
public float GetCooldown() { return(cooldown * (1 - PerkManager.GetAbilityCooldown(ID))); }
public float GetCritChance() { return(stats[currentActiveStat].crit.chance + PerkManager.GetFPSWeaponDamage(prefabID)); }
public void Init() { if (init) { return; } init = true; if (instance != null) { Destroy(gameObject); return; } instance = this; //load your custom/saved purchasedIDList here if you are doing a persistent perk system List <Perk> dbList = PerkDB.Load(); for (int i = 0; i < dbList.Count; i++) { if (!unavailableIDList.Contains(dbList[i].ID)) { Perk perk = dbList[i].Clone(); perkList.Add(perk); } } globalTowerModifier = new PerkTowerModifier(); globalAbilityModifier = new PerkAbilityModifier(); globalFPSWeaponModifier = new PerkFPSWeaponModifier(); emptyTowerModifier = new PerkTowerModifier(); emptyAbilityModifier = new PerkAbilityModifier(); emptyFPSWeaponModifier = new PerkFPSWeaponModifier(); int rscCount = ResourceManager.GetResourceCount(); for (int i = 0; i < rscCount; i++) { rscRegen.Add(0); rscGain.Add(0); rscCreepKilledGain.Add(0); rscWaveClearedGain.Add(0); rscRscTowerGain.Add(0); } for (int i = 0; i < perkList.Count; i++) { if (purchasedIDList.Contains(perkList[i].ID)) { if (perkList[i].type == _PerkType.NewTower || perkList[i].type == _PerkType.NewAbility || perkList[i].type == _PerkType.NewFPSWeapon) { StartCoroutine(DelayPurchasePerk(perkList[i])); } else { _PurchasePerk(perkList[i], false); //dont use rsc since these are pre-purchased perk } } } if (persistantProgress) { transform.parent = null; DontDestroyOnLoad(gameObject); } }
public float GetCritMultiplier() { return(stats[currentActiveStat].crit.dmgMultiplier + PerkManager.GetFPSWeaponDamage(prefabID)); }
public static int GetPlayerLifeCap() { return(instance.capLife ? instance.playerLifeCap + PerkManager.GetLifeCapModifier() : -1); }
void UpdatePerkPoint(int point) { lbPerkPoint.text = "Points: " + PerkManager.GetPerkPoint(); }