private void InitiateRAttack() { // We cannot fire if we are doing another attack or overheated. if (!CanAttack() || overheating || currentHeat >= maxHeat) { return; } AdjustCurrentHeat(generatedHeat); // We always have a delay before heat decays. heatDelayCounter = heatDecayDelay; attackAction.SetFunctions(null, EndOfRAttack); attackAction.SetTimes(gunAttackTime, gunAttackCooldown); GameObject bullet = OBJ_POOLER.PullFromPool(PLAYER_PROJECTILE_POOL_NAME); Vector2 dir = GetDirectionOfAttack(); bullet.transform.position = (Vector2)transform.position + dir; bullet.transform.rotation = Quaternion.Euler(0f, 0f, Mathf.Atan2(dir.y, dir.x)); HB_PlayerEnergyShot script = bullet.GetComponent <HB_PlayerEnergyShot>(); script.speed = 45f; script.owner = gameObject; Rigidbody2D projRigid = bullet.GetComponent <Rigidbody2D>(); projRigid.velocity = (dir * script.speed); attackAction.StartAction(); }