summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs
blob: 6aa06d0190ba808235b75a7a43544a2ae80f681a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;

// 蜂鸣
public class LensEffect_Buzz : LensEffectBase
{
	public override ERenderingEvent renderingEvents => ERenderingEvent.AfterForwardAlpha;

	public LensEffect_Buzz() : base()
	{

	}

	public override void AfterForwardAlpha(EStage stage, CommandBuffer cb)
	{
		if (stage == EStage.Before)
		{
			Before(cb);
		}
		else if (stage == EStage.After)
		{
			After(cb);
		}
	}

	void Before(CommandBuffer cb)
	{
		MaterialEntry buzz = ClaimMaterial(StaticDefine.shaders[EShader.Buzz].name);

		cb.SetGlobalTexture("_UnitDepthTexture", owner.unitPreprocessing.unitDepthTexture);
		cb.Blit(BuiltinRenderTextureType.CameraTarget, BuiltinRenderTextureType.CameraTarget, buzz.material);
	}

	void After(CommandBuffer cb)
	{

	}

}