Hello,
I would like to trigger post processing to change the scene color from normal to black and white. However this code does not seem to work. Im using an event system to trigger it after the player has reached a certain point in the game.
Thanks for the help
using UnityEngine;
using System.Collections;
using MoreMountains.Tools;
using UnityEngine.Rendering.PostProcessing;
namespace MoreMountains.InfiniteRunnerEngine
{
public class ExampleScenario : ScenarioManager
{
public DistanceSpawner HillSpawner;
public DistanceSpawner MushroomSpawner;
public PostProcessVolume editPostProcess;
private ColorGrading blackAndWhite;
protected override void Scenario()
{
AddScoreEvent(200f, () => SwitchToNightMode());
/*AddScoreEvent(220f, () => SwitchToNothing());
AddScoreEvent(250f, ()=> SwitchToMushroomSpawner());
AddScoreEvent(330f, () => SwitchToNothing());
AddScoreEvent(350f, () => SwitchToHillSpawner());
AddScoreEvent(430f, () => SwitchToNothing());
AddScoreEvent(450f, () => SwitchToMushroomSpawner());
AddScoreEvent(510f, () => SwitchToNothing());
AddScoreEvent(550f, () => SwitchToHillSpawner());*/
}
protected virtual void SwitchToHillSpawner()
{
HillSpawner.gameObject.GetComponent().Spawning = true;
MushroomSpawner.gameObject.gameObject.GetComponent().Spawning = false;
}
protected virtual void SwitchToNothing()
{
HillSpawner.gameObject.GetComponent().Spawning = false;
MushroomSpawner.gameObject.gameObject.GetComponent().Spawning = false;
}
protected virtual void SwitchToMushroomSpawner()
{
HillSpawner.gameObject.GetComponent().Spawning = false;
MushroomSpawner.gameObject.gameObject.GetComponent().Spawning = true;
}
protected virtual void SwitchToNightMode()
{
blackAndWhite.saturation.value = -100f;
}
}
}
↧