summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs
blob: 1e8c6d4968856f7a8bc13fc7e3469755b203a52a (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;

namespace AmplifyShaderEditor
{
	public class SignalGeneratorNode : ParentNode, ISignalGenerator
	{
		public SignalGeneratorNode() : base() { }
		public SignalGeneratorNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { }
		
		protected override void CommonInit( int uniqueId )
		{
			base.CommonInit( uniqueId );
			SelfPowered = true;
		}

		public void GenerateSignalPropagation()
		{
			System.Type myType = GetType();
			for ( int i = 0; i < m_inputPorts.Count; i++ )
			{
				if ( m_inputPorts[ i ].IsConnected )
				{
					m_inputPorts[ i ].GetOutputNode().ActivateNode( UniqueId, i, myType );
				}
			}
		}

		public void GenerateSignalInibitor()
		{
			for ( int i = 0; i < m_inputPorts.Count; i++ )
			{
				if( m_inputPorts[ i ].IsConnected )
				{
					ParentNode node = m_inputPorts[ i ].GetOutputNode();
					if( node != null )
						node.DeactivateNode( i, false );
				}
			}
		}
	}
}