void fireShot() { if (cooldownTimer != 0) { return; } if (delayTimer <= 0) { targetPlayer(); GameObject bullet_clone = Instantiate(Resources.Load("Prefabs/Bullets/bullet_enemy_snap"), tsfm.position, tsfm.rotation) as GameObject; bullet_velocitySnap bullet_clone_bullet = bullet_clone.GetComponent <bullet_velocitySnap>(); bullet_clone_bullet.speed = bullet_speed; bullet_clone_bullet.spawn_time = shotSpawnTime; bullet_clone_bullet.setSnapVelocity(driver_velocity); bullet_clone.transform.rotation = Quaternion.Euler(0, 0, target_angle); shotCounter--; delayTimer = shotDelay; } if (shotCounter == 0) { cooldownTimer = weaponCooldown; delayTimer = 0; } }
// Will redo after making subclasses from bullets void makeShot(float angle) { //* GameObject bullet_clone = Instantiate(Resources.Load("Prefabs/Bullets/bullet_player"), shot_spawn.position, shot_spawn.rotation) as GameObject; bullet_velocitySnap bullet_clone_bullet = bullet_clone.GetComponent <bullet_velocitySnap>(); bullet_clone_bullet.speed = driver.getSpeed(); bullet_clone_bullet.spawn_time = 5; bullet_clone.transform.Rotate(0, 0, angle); bullet_clone_bullet.setSnapVelocity(driver.gameObject.GetComponent <Rigidbody2D>().velocity); bullet_clone_bullet.setPlayerID(driver.getPlayerID()); //*/ }