/// <summary> /// 创建Cube操作 /// </summary> public void OnCreate() { CommandDataEntity cmdEntity = (CommandDataEntity)FindObjectOfType <CommandDataModel>().DataEntity; CreateCommandStr str = new CreateCommandStr(); //随机坐标 str.Position = new Vector3(Random.Range(-7, 11), Random.Range(-4, 6), Random.Range(0, 50)); cmdEntity.CreatePartMessage = str; }
/// <summary> /// 业务逻辑处理函数 /// </summary> /// <param name="evt"></param> public override void ProcessLogic(PropertyMessage evt) { if (evt.PropertyName.Equals("CreatePartMessage")) { //给参数赋值 CreateCommandStr str = (CreateCommandStr)evt.NewValue; CubeCreateControllCommand cmd = new CubeCreateControllCommand(); cmd.Position = str.Position; _commandService.GetCommandStack().Execute(cmd); } }