public void SetBuilding(string buildingType) { buildingOffset = -0.02f; buildingSpeed = 10; this.buildingType = buildingType; this.gameObject.name = buildingType; LoadBuildingStats(Towers.instance.GetBuilding(buildingType)); MeshFilter buildingMesh = this.gameObject.GetComponentInChildren <MeshFilter>(); if (buildingMesh != null) { buildingMesh.mesh = Towers.GetMesh(GetBuildingType(buildingType)); } buildingSpeed = Mathf.Abs(buildingOffset / buildingSpeed); //modelObject.transform.Translate(new Vector3(0, buildingOffset, 0), Space.World); if (building == Building.no) { modelObject.transform.Translate(new Vector3(0, buildingOffset, 0), Space.World); building = Building.yes; } if (buildingType == "base") { GameObject goal = new GameObject("Goal"); goal.transform.position = this.transform.position; TerrainGen.goal = goal; GetComponentInChildren <MeshCollider>().sharedMesh = Towers.baseColl; } health = maxHealth; }
public void SetAugmentType(string newType) { type = newType; MeshFilter mesh = this.gameObject.GetComponentInChildren <MeshFilter>(); if (mesh != null) { mesh.mesh = Towers.GetMesh(Towers.GetAugmentType(newType)); } buildingOffset = -0.02f; buildingSpeed = 10; Dictionary <string, float> values = Towers.instance.GetAugment(newType); LoadBuildingStats(values); LoadAugmentStats(values); buildingSpeed = Mathf.Abs(buildingOffset / buildingSpeed); if (building == Building.no) { modelObject.transform.Translate(new Vector3(0, buildingOffset, 0), Space.World); building = Building.yes; } }
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(); }