Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine($"Creating a new ColorObserver with {Color.Blue} color.");
            ColorObserver ObserverBlue = new ColorObserver(Color.Blue);

            Console.WriteLine($"Creating a new ColorObserver with {Color.Green} color.");
            ColorObserver ObserverGreen = new ColorObserver(Color.Green);

            ColorSubject subject = new ColorSubject();

            subject.Attach(ObserverBlue);
            subject.Attach(ObserverGreen);

            subject.ChangeColor(Color.Red);
        }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     _MeshRenderer   = GetComponent <MeshRenderer>();
     OnColorChanged += (color) => { Debug.Log(color); };
 }