///<summary>用于更新角色的运动状态</summary> // Update is called once per frame void Update() //用于监听对人物的控制事件 { UpdateAction(); //更新角色动作 //!problem这个问题暂时搁浅 ///身体倾斜控制水平位移 ///f键:向左偏移 ///g键:向右偏移 if (Input.GetKeyDown("f") && State.OFFSET_CURRENT != State.OFFSET_LEFT) //向左偏移,当POS_CURRENT == POS_LEFT的时候表示已经到了最左边了 { transform.localPosition -= 0.3f * ToolsFunction.OffsetPosiion(DataConst.MeDisplay, 0); } if (Input.GetKeyDown("g") && State.OFFSET_CURRENT != State.OFFSET_RIGHT) //向右偏移 { transform.localPosition += 0.3f * ToolsFunction.OffsetPosiion(DataConst.MeDisplay, 1); } if (false == State.OFFSET_IDLE && false == State.KEEP_IDLE) //表示没有撞到墙, 并且没有撞到障碍物 { transform.Translate(vDirection / nRate); //暂时设定为100 } if (Input.GetKeyDown("t")) //用于测试的按钮 { Rectangle rec = new Rectangle(1, 1, 1, 1); Debug.Log(Time.time + " rectangle side: " + rec.X_Min); Debug.Log(Time.time + " rectangle side: " + rec.X_Max); } }