/// <summary> /// 业务逻辑处理函数 /// </summary> /// <param name="evt"></param> public override void ProcessLogic(PropertyMessage evt) { if (evt.PropertyName.Equals("ColorParMessage")) { //给参数赋值 ColorCommandStr str = (ColorCommandStr)evt.NewValue; CubeColorControllCommand cmd = new CubeColorControllCommand(); cmd.OldColor = str.OldColor; cmd.NewColor = str.NewColor; cmd.ColorObjectID = str.ObjectID; _commandService.GetCommandStack().Execute(cmd); } }
/// <summary> /// 改变Cube颜色 /// </summary> public void OnChangeColor() { if (IsClickedPart) { CommandDataEntity cmdEntity = (CommandDataEntity)FindObjectOfType <CommandDataModel>().DataEntity; ColorCommandStr str = new ColorCommandStr(); str.ObjectID = cubeDataEntity.objectID; //记录开始的颜色 str.OldColor = cubeDataModdel.gameObject.GetComponent <MeshRenderer>().material.color; //随机新的颜色 str.NewColor = new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f)); cmdEntity.ColorParMessage = str; IsClickedPart = false; } }