示例#1
0
文件: Dispatcher.cs 项目: MrEk0/RPG
        //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);
            }
        }
示例#2
0
        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");
            }
        }