public override void InteractiveDetection(CharacterInteractiveCpt characterInt) { if (Input.GetButtonDown(InputInfo.Interactive_E)) { if (mInteractiveObj != null) { AudioHandler.Instance.PlaySound(AudioSoundEnum.Door); SceneTownManager sceneTownManager = GameScenesHandler.Instance.manager.GetSceneManager <SceneTownManager>(); sceneTownManager.GetBuildingDoorPosition(positionChange, out Vector2 outDoorPosition, out Vector2 inDoorPosition); //本身是在外 要转换到里 int checkOutOrIn = 0; if (OutOrIn == 0) { checkOutOrIn = 1; //关闭环境音效 AudioHandler.Instance.PauseEnvironment(); mInteractiveObj.transform.position = inDoorPosition; } //本身是在里 要转换到外 else { checkOutOrIn = 0; //开启环境音效 AudioHandler.Instance.RestoreEnvironment(); mInteractiveObj.transform.position = outDoorPosition; } //检测故事 GameEventHandler.Instance.EventTriggerForStory(positionChange, checkOutOrIn); } } }
/// <summary> /// 前往建筑物 /// </summary> public void IntentForGoToBuilding(TownBuildingEnum buildingEnum) { SceneTownManager sceneTownManager = GameScenesHandler.Instance.manager.GetSceneManager <SceneTownManager>(); this.buildingToGo = buildingEnum; //获取建筑的门 sceneTownManager.GetBuildingDoorPosition(buildingEnum, out Vector2 outDoorPostion, out Vector2 inDoorPosition); buildingOutDoorPosition = outDoorPostion; buildingInDoorPosition = inDoorPosition; //前往门 characterMoveCpt.SetDestination(buildingOutDoorPosition); }