Ejemplo n.º 1
0
        /// <summary>
        /// 添加一个塔
        /// </summary>
        public void AddTower()
        {
            CommandDataEntity     cmdEntity = (CommandDataEntity)FindObjectOfType <CommandDataModel>().DataEntity;
            CreateTowerCommandStr str       = new CreateTowerCommandStr();

            //随机坐标
            str.Position = new Vector3(Random.Range(-7, 11), Random.Range(-4, 6), Random.Range(0, 50));
            cmdEntity.CreateTowerMessage = str;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 业务逻辑处理函数
 /// </summary>
 /// <param name="evt"></param>
 public override void ProcessLogic(PropertyMessage evt)
 {
     if (evt.PropertyName.Equals("CreateTowerMessage"))
     {
         //给参数赋值
         CreateTowerCommandStr      str = (CreateTowerCommandStr)evt.NewValue;
         TowerCreateControllCommand cmd = new TowerCreateControllCommand();
         cmd.Position = str.Position;
         _commandService.GetCommandStack().Execute(cmd);
     }
     if (evt.PropertyName.Equals("CreatePhoneMessage"))
     {
         //给参数赋值
         CreatePhoneCommandStr      str = (CreatePhoneCommandStr)evt.NewValue;
         PhoneCreateControllCommand cmd = new PhoneCreateControllCommand();
         cmd.Position = str.Position;
         _commandService.GetCommandStack().Execute(cmd);
     }
 }