public void SetTower(TowerTypes tower) { gameObject.name = GetTowerTypeString(tower); //if (towerType == TowerTypes.none) towerType = tower; attackSpeed = 0; attackRange = 0; attackDamage = 0; attackProjectiles = 1; projectileSpeed = 0; projectileChain = 0; projectileChainDistanceMin = 0; projectileChainDistanceMax = 3; projectileForkCount = 0; projectileForkProjectiles = 0; projectileAoE = 0; projectileAoEFalloff = true; projectileHoming = true; projectileInstant = false; projectileDoesArc = false; moveSpeedMult = 0; moveSpeedStatic = 0; damageMult = 0; damageStatic = 0; damageOverTime = 0; damageOverTimeDecay = 0; buildingOffset = -0.5f; buildingSpeed = 5; duration = 0; endTime = 0; Dictionary <string, float> values; values = Towers.instance.GetTower(GetTowerTypeString(tower)); LoadBuildingStats(values); LoadTowerStats(values); buildingSpeed = Mathf.Abs(buildingOffset / buildingSpeed); MeshFilter towerMesh = this.gameObject.GetComponentInChildren <MeshFilter>(); if (towerMesh != null) { towerMesh.mesh = Towers.GetMesh(tower); } MeshRenderer towerRenderer = this.gameObject.GetComponentInChildren <MeshRenderer>(); if (towerRenderer != null) { towerRenderer.material = Towers.GetMaterial(tower); } if (building == Building.no) { modelObject.transform.Translate(new Vector3(0, buildingOffset, 0), Space.World); building = Building.yes; } UpdateHexes(); }