Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using UnityEngine;
  4. using System.Collections.Generic;
  5. namespace AmplifyShaderEditor
  6. {
  7. public class PreMadeShaders
  8. {
  9. public static readonly string FlatColorSequenceId = "Flat Color";
  10. private Dictionary<string, ActionSequence> m_actionLib;
  11. public PreMadeShaders()
  12. {
  13. m_actionLib = new Dictionary<string, ActionSequence>();
  14. ActionSequence sequence = new ActionSequence( FlatColorSequenceId );
  15. sequence.AddToSequence( new CreateNodeActionData( 1, typeof( ColorNode ), new Vector2( -250, 125 ) ) );
  16. sequence.AddToSequence( new CreateConnectionActionData( 0, 4, 1, 0 ) );
  17. m_actionLib.Add( sequence.Name, sequence );
  18. }
  19. public ActionSequence GetSequence( string name )
  20. {
  21. if ( m_actionLib.ContainsKey( name ) )
  22. {
  23. return m_actionLib[ name ];
  24. }
  25. return null;
  26. }
  27. public void Destroy()
  28. {
  29. var items = m_actionLib.GetEnumerator();
  30. while ( items.MoveNext() )
  31. {
  32. items.Current.Value.Destroy();
  33. }
  34. m_actionLib.Clear();
  35. m_actionLib = null;
  36. }
  37. public ActionSequence FlatColorSequence
  38. {
  39. get { return m_actionLib[ FlatColorSequenceId ]; }
  40. }
  41. }
  42. }