public void Initialize(StationData data) { Initialize(); stationData = data; hardPoints = stationData.designData.Hull.GetHardPoints(); unitMeshObject = transform.GetChild(0).gameObject; currentMaterial = GetComponentInChildren <Renderer>().material; shipMaterial = currentMaterial; if (stationData.GetJammingCount() > 0 && stationData.GetJammingRange() > 0 && stationData.GetJammingDelay() > 0) { hasJamming = true; JammingTimer = stationData.GetJammingDelay(); } hasPointDefense = stationData.hasPointDefense(); unitWingsComponent = new UnitWingsParentComponent(this, data); }
protected override void Update() { if (Destroyed) { dissolveValue += Time.deltaTime; currentMaterial.SetFloat("_Dissolve", dissolveValue); } else { HighlightUpdate(); ApplyDamageOverlay(stationData.GetHealthPercentOverlay()); if (!isPaused) { //SelfDesctruct if (SelfDestructTimer > 0) { SelfDestructTimer -= GetDeltaTime(); if (textMeshController != null) { textMeshController.SetText(SelfDestructTimer.ToString("0.#")); } if (SelfDestructTimer <= 0) { stationData.SelfDestruct(); } } else { if (textMeshController != null) { Destroy(textMeshController.gameObject); } } stationData.Update(); if (!Disabled && stationData.crew > 0) { //Jamming if (hasJamming) { if (JammingTimer > 0) { JammingTimer -= GetDeltaTime(); } else { JammingTimer = stationData.GetJammingDelay(); shipManager.JamEnemyProjectilesInRange(transform.position, stationData.GetJammingRangeSqr(), stationData.GetJammingCount()); } } //Transporting if (TransportTargetTroops != null || TransportTargetCrew != null) { if (transportTimer > 0) { transportTimer -= GetDeltaTime(); } else { transportTimer = 10f / (stationData.fleetData.GetTransport() + 1); if (TransportTargetTroops != null) { TransportTroopsToShip(TransportTargetTroops); } if (TransportTargetCrew != null) { TransportCrewToShip(TransportTargetCrew); } } } if (WeaponCheckTimer > 0) { WeaponCheckTimer -= GetDeltaTime(); } else { if (Target != null && Target.isDestroyed()) { Target = null; } WeaponCheckTimer = ResourceManager.gameConstants.WeaponCheckTime; if (!HoldFire) { CheckWeapons(); } } } } } }