private void Fire() { gameTimer = 0f; audioSource.Play(); fireLight.enabled = true; particleSystem.Stop(); particleSystem.Play(); fireLightRenderer.enabled = true; fireLightRenderer.SetPosition(0, transform.position); Ray rayLine = new Ray(); RaycastHit raycastHit; rayLine.origin = transform.position; rayLine.direction = transform.forward; if (Physics.Raycast(rayLine, out raycastHit, firedistance)) { alienHealthInstance = raycastHit.collider.GetComponent <AlienHealth>(); strongAlienHealthInstance = raycastHit.collider.GetComponent <StrongAlienHealth>(); if (alienHealthInstance != null) { alienHealthInstance.WarriorAttack(harm, raycastHit.point); //strongAlienHealthInstance.WarriorAttack(harm, raycastHit.point); } else if (strongAlienHealthInstance != null) { strongAlienHealthInstance.WarriorAttack(harm, raycastHit.point); } else { return; } fireLightRenderer.SetPosition(1, raycastHit.point); } }
private void Awake() { warriorHealth = GameObject.FindGameObjectWithTag("Warrior").GetComponent <WarriorHealth>(); strongAlienMovement = GetComponent <StrongAlienMovement>(); strongAlienHealth = GetComponent <StrongAlienHealth>(); }