|
发表于 2020-12-1 19:53:52
|
显示全部楼层
直接把这个function替换了吧,要注意这样还是需要人物靠近触发器才可以点击触发
- function doTrigger(){
- if(nowPage == null) return;
- var nowRect = rect;
- //if(char != null){
- // nowRect = char.getCharacter().getSpirte().GetRect();
- //}
- if(nowPage.type == 0 && !doEnd){//执行事件
- addTrigger();
- }else if(nowPage.type == 1 && !doEnd && nowRect != null && RV.NowMap.getActor().getCharacter().isContactFortRect(nowRect)){
- addTrigger();
- }else if(nowPage.type == 2 && !doEnd && nowRect != null && RV.NowMap.getActor().getCharacter().isContactFortRect(nowRect) && isTowardsMe()){
- icon.visible = true;
- IVal.scene.getMainUI().setPhoneButton(true);
- if( IInput.up || IVal.scene.getMainUI().nextClick){
- IInput.up = false;
- //面朝角色
- if(char != null){
- var character = char.getCharacter();
- var dx = character.x - RV.NowMap.getActor().getCharacter().x;
- var dy = character.y - RV.NowMap.getActor().getCharacter().y;
- if(Math.abs(dx) > Math.abs(dy)){
- if(dx > 0){
- character.setDir(1);
- }else{
- character.setDir(2);
- }
- }else{
- if(dy > 0){
- character.setDir(3);
- }else{
- character.setDir(0);
- }
- }
- addTrigger();
- }else{
- addTrigger();
- }
- IVal.scene.getMainUI().nextClick = false;
- }
- }else{
- icon.visible = false;
- }
- }
复制代码 |
|