public static void RemoveTower(FarmTower farm) { if (!instance) { return; } if (instance.turrets.Count > 0) { instance.turrets.Remove(farm); } if (instance.turrets.Count < 1) { instance.gameObject.SetActive(false); } }
private void OnUnitAdded(Unit9 unit) { try { if (!unit.IsUnit) { return; } FarmUnit farmUnit; if (this.unitTypes.TryGetValue(unit.Name, out var type)) { farmUnit = (FarmUnit)Activator.CreateInstance(type, unit); } else if (unit.IsLaneCreep) { farmUnit = new FarmCreep(unit); } else if (unit.IsHero) { farmUnit = new FarmHero(unit); } else if (unit.IsTower) { farmUnit = new FarmTower(unit); } else { farmUnit = new FarmUnit(unit); } if (unit.IsMyControllable && unit.AttackCapability != AttackCapability.None && (unit.UnitState & UnitState.CommandRestricted) == 0) { farmUnit.CreateMenu(this.menuManager.UnitSettingsMenu); } this.units.Add(farmUnit); } catch (Exception e) { Logger.Error(e); } }
public static void AddNewFarmTower(FarmTower farm) { instance.turrets.Add(farm); }
public static void MakeFarmSpecial(FarmTower farm) { instance.farmBtn.SetActive(true); FarmSpecial.AddNewFarmTower(farm); }