{

    "ID": 2011003, //推箱子 箱子

    "EventTypeTag": [

        "NoneInteractEventWithAnim"

    ],

    "Events":{

        "OnCreate":{

            "Actions":[

                //更新箱子位置

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"boxPos_x1",

                    "Value": "getpos(X,2)"

                },

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"boxPos_y1",

                    "Value": "getpos(Y,2)"

                },

                {

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "boxLeftIndex_20110033",

                    "Value": 0

                },

                {

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "boxRightIndex_20110033",

                    "Value": 0

                },

                {

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "boxUpIndex_20110033",

                    "Value": 0

                },

                {

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "boxDownIndex_20110033",

                    "Value": 0

                },

                //判断四周是否有墙，值=1代表没有墙，=0代表有墙

                {

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "boxLeftIndex_20110033",

                    "Value": 1,//左无墙

                    "Predicates":[

                        {

                            "$type":"Share.CConfigEventByEventState",

                            "X":"scenevar(boxPos_x1)-1",

                            "Y":"scenevar(boxPos_y1)",

                            "NodeType":"All",

                            "EventType":"All",

                            "Position":"Absolute",

                            "Radius":0,

                            "VisibleState":["Visible","TemporaryVisibleAtAround"],

                            "Count":1,

                            "CompareType":"Equal"

                        }

                    ]

                },

                {

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "boxRightIndex_20110033",

                    "Value": 1,//右无墙

                    "Predicates":[

                        {

                            "$type":"Share.CConfigEventByEventState",

                            "X":"scenevar(boxPos_x1)+1",

                            "Y":"scenevar(boxPos_y1)",

                            "NodeType":"All",

                            "EventType":"All",

                            "Position":"Absolute",

                            "Radius":0,

                            "VisibleState":["Visible","TemporaryVisibleAtAround"],

                            "Count":1,

                            "CompareType":"Equal"

                        }

                    ]

                },

                {

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "boxUpIndex_20110033",

                    "Value": 1,//上无墙

                    "Predicates":[

                        {

                            "$type":"Share.CConfigEventByEventState",

                            "X":"scenevar(boxPos_x1)",

                            "Y":"scenevar(boxPos_y1)-1",

                            "NodeType":"All",

                            "EventType":"All",

                            "Position":"Absolute",

                            "Radius":0,

                            "VisibleState":["Visible","TemporaryVisibleAtAround"],

                            "Count":1,

                            "CompareType":"Equal"

                        }

                    ]

                },

                {

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "boxDownIndex_20110033",

                    "Value": 1,//下无墙

                    "Predicates":[

                        {

                            "$type":"Share.CConfigEventByEventState",

                            "X":"scenevar(boxPos_x1)",

                            "Y":"scenevar(boxPos_y1)+1",

                            "NodeType":"All",

                            "EventType":"All",

                            "Position":"Absolute",

                            "Radius":0,

                            "VisibleState":["Visible","TemporaryVisibleAtAround"],

                            "Count":1,

                            "CompareType":"Equal"

                        }

                    ]

                }

            ]

        },

        "OnStart":{

            "Actions":[

                //拿到箱子当前坐标

                // {

                //     "$type":"Share.CConfigSetHollowVariable",

                //     "Key":"boxPos_x1",

                //     "Value": "getpos(X,2)"

                // },

                // {

                //     "$type":"Share.CConfigSetHollowVariable",

                //     "Key":"boxPos_y1",

                //     "Value": "getpos(Y,2)" 

                

                {

                    "$type":"Share.CConfigSetConditionProgress",

                    "ConditionID":30060143,

                    "Progress":1,

                    "ModifyType":"Add"

                },

                //清空之前的Delta坐标

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"DeltaX",

                    "Value": 0

                },

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"DeltaY",

                    "Value": 0

                },        

                //计算DeltaX和DeltaY

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"DeltaX",

                    "Value": "scenevar(boxPos_x1)-scenevar(playerPos_x2)"

                },

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"DeltaY",

                    "Value": "scenevar(boxPos_y1)-scenevar(playerPos_y2)"

                },

                //判断玩家之前在箱子的哪个方向

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"Direction",

                    "Value": 0, //Left

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "DeltaX",

                            "CompareType": "Greater",

                            "Count": 0

                        }

                    ]

                },

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"Direction",

                    "Value": 1, //Right

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "DeltaX",

                            "CompareType": "Less",

                            "Count": 0

                        }

                    ]

                },

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"Direction",

                    "Value": 2, //Top

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "DeltaY",

                            "CompareType": "Greater",

                            "Count": 0

                        }

                    ]

                },

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"Direction",

                    "Value": 3, //Down

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "DeltaY",

                            "CompareType": "Less",

                            "Count": 0

                        }

                    ]

                },

                //判断是否推回玩家（玩家在左）

                {

                   "$type": "Share.CConfigJump",

                    "Jump": "PushBack",

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "Direction",

                            "CompareType": "Equal",

                            "Count": 0 //玩家在左侧

                        },

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "boxRightIndex_20110033",

                            "CompareType": "Equal",

                            "Count": 0 //右侧有墙，所以无法向右移动，需要推回玩家

                        }

                    ]

                },

                //判断是否推回玩家（玩家在右侧）

                {

                   "$type": "Share.CConfigJump",

                    "Jump": "PushBack",

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "Direction",

                            "CompareType": "Equal",

                            "Count": 1 //玩家在右侧

                        },

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "boxLeftIndex_20110033",

                            "CompareType": "Equal",

                            "Count": 0 //左侧有墙，所以无法向左移动，需要推回玩家

                        }

                    ]

                },

                //判断是否推回玩家（玩家在上方）

                {

                   "$type": "Share.CConfigJump",

                    "Jump": "PushBack",

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "Direction",

                            "CompareType": "Equal",

                            "Count": 2 //玩家在上方

                        },

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "boxDownIndex_20110033",

                            "CompareType": "Equal",

                            "Count": 0 //下方有墙，所以无法向下移动，需要推回玩家

                        }

                    ]

                },

                //判断是否推回玩家（玩家在下方）

                {

                   "$type": "Share.CConfigJump",

                    "Jump": "PushBack",

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "Direction",

                            "CompareType": "Equal",

                            "Count": 3 //玩家在下方

                        },

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "boxUpIndex_20110033",

                            "CompareType": "Equal",

                            "Count": 0 //上方有墙，所以无法向上移动，需要推回玩家

                        }

                    ]

                },

                {

                    "$type": "Share.CConfigJump",

                    "Jump": "Push"

                }

            ]

        },

        "Push":{

            "Actions":[

                //往右推

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"boxPos_x1",

                    "Value": "getpos(X,2)+1",

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "Direction",

                            "CompareType": "Equal",

                            "Count": 0

                        }

                    ]

                },

                //往左推

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"boxPos_x1",

                    "Value": "getpos(X,2)-1",

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "Direction",

                            "CompareType": "Equal",

                            "Count": 1

                        }

                    ]

                },

                //往下推

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"boxPos_y1",

                    "Value": "getpos(Y,2)+1",

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "Direction",

                            "CompareType": "Equal",

                            "Count": 2

                        }

                    ]

                },

                //往上推

                {

                    "$type":"Share.CConfigSetHollowVariable",

                    "Key":"boxPos_y1",

                    "Value": "getpos(Y,2)-1",

                    "Predicates":[

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "Direction",

                            "CompareType": "Equal",

                            "Count": 3

                        }

                    ]

                },

                {

                    "$type": "Share.CConfigFinishEvent"

                }

            ]

        },

        "PushBack":{

            "Actions":[

                {

                    "$type": "Share.CConfigShowTip",

                    "TipID": 201100301

                },

                {

                    "$type":"Share.CConfigPushBack"

                },

                {

                    "$type": "Share.CConfigFinishEvent"

                }

            ]

        }

    }

}    