void Minigun(EnemyAnimations meme) { damage = 250; range = 70; //If statement if we hit something // Debug.Log("Minigun"); y++; if (ammoMP <= 0) { // Animator anim = GetComponent<Animator>(); anim.SetTrigger("MP40StopFiring"); firing = false; } else { // Debug.Log("Can damage"); if (y % 8 == 0) { ammoMP--; ammoMP--; ammoMP--; if (meme != null) { meme.takeDamage(damage * Random.Range(0.5f, 1.5f)); } } } }
void Gun() { damage = 400; range = 100; // Animator anim = GetComponent<Animator>(); anim.SetTrigger("ToKnife"); RaycastHit hit; //If statement if we hit something if (Physics.Raycast(camera.transform.position, camera.transform.forward, out hit, 100)) { // Debug.Log(hit.transform.name); EnemyAnimations target = hit.transform.GetComponent <EnemyAnimations>(); y++; if (target != null) { // if (y % 2 == 0) { // Debug.Log("Can damage"); target.takeDamage(400 * Random.Range(0.5f, 1.5f)); } } } }