public void LaserAwake() { cannonsPanel = null; laserTickTimer.SetTimer(0); laserActive = false; laserEffectActive = false; laserHitEffect.SetActive(false); laserEffect.SetActive(false); laserMask.localScale = new Vector3(laserMask.lossyScale.x, maximumDistance, laserMask.lossyScale.z); }
void Awake() { instance = this; RestoreMaximumHealth(); SetPanelPosition(); SetScale(); StartCoroutine(GameController.ActionAfterFewFramesCoroutine(1, () => { SetLeftCannon(1); SetRightCannon(1); })); }
public void LaserActive() { if (Physics.Raycast(spawnerTransform.position, direction, out rayHit, maximumDistance, (1 << LayerMask.NameToLayer("CannonPanel")))) { if (cannonsPanel == null) { cannonsPanel = rayHit.collider.GetComponent <CannonsPanelCollider> ().cannonPanel; } float maskScaleY = Vector3.Distance(spawnerTransform.position, rayHit.point) * 1.65f; laserMask.localScale = new Vector3(laserMask.lossyScale.x, maskScaleY, laserMask.localScale.z); if (!laserEffectActive) { laserHitEffect.SetActive(true); laserEffect.SetActive(true); laserEffectActive = true; } if (laserTickTimer.TimeIsOver()) { cannonsPanel.MakeDamage(ship.explodeObject.damageHealthParam.damage); laserTickTimer.SetTimer(ship.explodeObject.damageHealthParam.damageTickTime); } } }