//Shooting bullet method void Shooting() { //Looking at where the player is facing float direction = Mathf.Atan2(currentDirection.y, currentDirection.x); //Instantiating the object with regards to where the player is facing GameObject newObject = Instantiate(myObject, transform.position + currentDirection.normalized * 2, Quaternion.Euler(0f, 0f, direction)); // Getting bullet movement for the enemy bullet BulletMovementEnemy movement = newObject.GetComponent <BulletMovementEnemy>(); if (movement) { //Calling the movement method movement.movement(currentDirection); } }
//Ultimate Ability IEnumeration method void Shooting() //void Shooting() { //Starting by creating the projectilek //Looking at where the player is facing float direction = Mathf.Atan2(currentDirection.y, currentDirection.x); //Instantiating the object with regards to where the player is facing GameObject newObject = Instantiate(myObject, transform.position + currentDirection.normalized * 3, Quaternion.Euler(0f, 0f, direction)); BulletMovementEnemy movement = newObject.GetComponent <BulletMovementEnemy>(); if (movement) { movement.movement(currentDirection); } }