public void SpawnHitPS(HitParticles type, Vector3 pos, Quaternion rot) { if (this._psSpawnPool) { this._psSpawnPool.Spawn(this.HitPSPrefabs[(int)type], pos, rot); } }
void Update() { if (BurnParticles.isPlaying) { BurnParticles.Stop(); } if (BeamActive) { if (!EmitParticles.isPlaying) { EmitParticles.Play(); } if (!EyeFlareParticles.isPlaying) { EyeFlareParticles.Play(); } Vector2 dir = new Vector2(this.transform.forward.x, this.transform.forward.y); Ray2D r = new Ray2D(this.transform.position, dir.normalized); float maxfiredist = 30f; RaycastHit2D re = Physics2D.Raycast(r.origin, r.direction, maxfiredist, LayerMask.GetMask(new string[] { "Geometry", "Player" })); if (!(re.distance <= 0f)) { Astronaut a = re.collider.gameObject.GetComponent <Astronaut>(); if ((a != null)) { if ((a.Alive)) { float dps = 80f; a.TakeDamage(dps * Time.deltaTime, new Vector3()); BurnParticles.transform.position = new Vector3(re.point.x, re.point.y, 0f); BurnParticles.Emit(10); } HitParticles.transform.position = new Vector3(re.point.x, re.point.y, 0f); HitParticles.Emit(1); } else if (re.collider.gameObject.layer == LayerMask.NameToLayer("Geometry")) { HitParticles.transform.position = new Vector3(re.point.x, re.point.y, 0f); HitParticles.Emit(1); BurnParticles.transform.position = new Vector3(re.point.x, re.point.y, 0f); BurnParticles.Emit(1); } //Perform Raycasts MyLineRenderer.SetPosition(0, r.origin); MyLineRenderer.SetPosition(1, re.point); } else { //Miss MyLineRenderer.SetPosition(0, r.origin); MyLineRenderer.SetPosition(1, r.origin + ((r.direction.normalized) * maxfiredist)); } MyLineRenderer.enabled = true; } else { MyLineRenderer.enabled = false; if (EmitParticles.isPlaying) { EmitParticles.Stop(); } if (EyeFlareParticles.isPlaying) { EyeFlareParticles.Stop(); } } }
void Start() { game = GameManager.instance; centerX = Screen.width / 2; centerY = Screen.height / 2; cam = Camera.main.camera; controller = transform.root.GetComponent<CharacterController>(); hitParticles = game.weapons.hitParticles; shootFrom = transform.FindChild("ShootFrom").gameObject; animator = GetComponent<Animator>(); }