//public Dispatcher(Aircraft boing, Airbus airbus) //{ // this.boing = (Boing)boing; // this.airbus = airbus; //} public void Notify(Aircraft aircraft, string msg) { if (aircraft == Boing) { Airbus.Notify(msg); } else if (aircraft == Airbus) { Boing.Notify(msg); } }
private void Update() { if (Input.GetKeyDown(KeyCode.Space)) { Dispatcher dispatcher = new Dispatcher(); Boing boing = new Boing(dispatcher); Airbus airbus = new Airbus(dispatcher); dispatcher.Boing = boing; dispatcher.Airbus = airbus; boing.Message("Boing's altitude is 1800"); airbus.Message("Airbus 337 is on 2300 meters above the surface"); } }