コード例 #1
0
    /// <summary>
    /// Shoots flare, deducts player's energy accordingly and
    /// zooms out camera to see more environment around player.
    /// </summary>
    private void ShootFlare()
    {
        player.LightEnergy.Deplete(flareEnergyCost);
        // Apply recoil in the opposite direction the flare was shot
        rigidbody.AddForce(-flareSpawnObject.right * recoilForce, ForceMode.Impulse);
        controllerRumble.ShotFlare();   // Rumble the controller
        timer = 0.0f;
        flareSound.ShootFlareSound();

        //reset all values for the zoom whenever player fires a flare
        if (smoothCamera != null)
        {
            smoothCamera.MaxZoomOut();
            smoothCamera.ResetTimer();
        }
    }