IEnumerator AttackOverTime() { TalkAudio.clip = AttackClip; TalkAudio.Play(); ScanAudio.Play(); for (int i = 0; i < Particles.Length; i++) { Particles [i].emissionRate = ElevatedEmissionRate; Particles [i].startSpeed = ElevatedEmissionSpeed; } if (mPowerBeam == null) { mPowerBeam = (GameObject.Instantiate(BeamPrefab.gameObject, HeadPivot.position, HeadPivot.rotation) as GameObject).GetComponent <PowerBeam> (); } mEffectSphere = (GameObject.Instantiate(EffectSpherePrefab.gameObject) as GameObject).GetComponent <MagicEffectSphere> (); mEffectSphere.transform.position = AttackTarget.position; mEffectSphere.RTExpansionTime = 3f; mEffectSphere.RTDuration = 10f; mEffectSphere.RTCooldownTime = 3f; mPowerBeam.WarmUpColor = Color.yellow; mPowerBeam.FireColor = Color.yellow; mPowerBeam.AttachTo(HeadPivot, AttackTarget); mPowerBeam.WarmUp(); mPowerBeam.Fire(5f); yield return(new WaitForSeconds(3f)); for (int i = 0; i < Particles.Length; i++) { Particles [i].emissionRate = NormalEmissionRate; Particles [i].startSpeed = NormalEmissionSpeed; } mPowerBeam.StopFiring(); while (mEffectSphere != null && !mEffectSphere.Depleted) { yield return(null); } GameObject.Destroy(mEffectSphere.gameObject); Attacking = false; yield break; }
public void OnReachHome() { mPrimaryTarget = Player.Local; Player.Local.Surroundings.AddHostile(this); BeamTarget = gameObject.CreateChild("BeamTarget"); BeamOrigin = Body.RootBodyPart.gameObject.FindOrCreateChild("OrbLuminiteLightPivot"); //GUIManager.PostIntrospection ("What's that sound?"); //get the structure, it should be loaded at this point if (!Structures.LoadedStructure("PlayerFarmHouse", out TargetStructure)) { Debug.Log("COULDN'T LOAD TARGET STRUCTURE PLAYER FARM HOUSE!"); } //get the beam ready GameObject newBeam = GameObject.Instantiate(FXManager.Get.BeamPrefab) as GameObject; Beam = newBeam.GetComponent <PowerBeam> (); }