示例#1
0
        public void Pray(BadMan husband, RunArgs args)
        {
            //拉来的数据
            var location = husband.Location;

            Console.WriteLine("老婆为远在:{0}的老公祈祷", location);
            if (args.NewLocation == "海南")
            {
                args.Cancel = true;
            }
        }
示例#2
0
        /// <summary>
        /// 公开一个方法 ,能激发事件
        /// </summary>
        /// <param name="NewLocaion"></param>
        public void RunAway(string NewLocaion)
        {
            //激发事件
            if (this.Run != null)
            {
                RunArgs args = new RunArgs();
                args.NewLocation = NewLocaion;
                args.OldLocaion  = this._location;


                this.Run(this, args);
                if (!args.Cancel)
                {
                    this._location = NewLocaion;
                }
                else
                {
                    Console.WriteLine("暂时不跑");
                }
            }
        }
示例#3
0
 public void CatchBadMan(BadMan target, RunArgs args)
 {
     //推来的数据
     Console.WriteLine("警察撤销:{0}的警力,重新在:{1}部属警力", args.OldLocaion, args.NewLocation);
 }