/// <summary> /// 添加一个手机 /// </summary> public void AddPhone() { CommandDataEntity cmdEntity = (CommandDataEntity)FindObjectOfType <CommandDataModel>().DataEntity; CreatePhoneCommandStr str = new CreatePhoneCommandStr(); //随机坐标 str.Position = new Vector3(Random.Range(-5f, 5f), 0.125f, Random.Range(-5f, 5f)); cmdEntity.CreatePhoneMessage = str; }
/// <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); } }