private void UpdatePlayUI(ref GUIComponent guiComp) { // condition foreach (var system in World.DefaultGameObjectInjectionWorld.Systems) { if (system is TeleportSystem) { TeleportSystem teleportSystem = system as TeleportSystem; switch (teleportSystem.CurSubSceneType) { case SubSceneType.sceneSelect: guiComp.currentUI |= GUIState.scenarioSelect; break; case SubSceneType.Scenario001_Hallway: case SubSceneType.Scenario001_Basement: guiComp.currentUI |= GUIState.inventory; guiComp.currentUI |= GUIState.bubble; break; case SubSceneType.Scenario001_LegacyOfClan: guiComp.currentUI |= GUIState.inventory; guiComp.currentUI |= GUIState.bubble; guiComp.currentUI |= GUIState.madness; break; default: guiComp.currentUI |= GUIState.customize; break; } } } }
/// <summary> /// Player spawn in specified location & mission setup /// </summary> private static void SpawnAtEndPoint() { TeleportSystem teleportSystem = FindObjectsOfType <TeleportSystem>().GetTeleport(_teleportName); VehiclesContainer.SpawnCar(teleportSystem.SpawnPoint.position, teleportSystem.SpawnPoint.rotation); MissionController.Setup(); }
/// <summary> /// 문에 접근했을 때 /// </summary> public void focusingMove() { // // (18.08.08) onDoorMove()의 이름 변경. // // 이동될 문의 좌표로 서브 카메라의 좌표 고정. 외부에서 doorCoord를 입력받습니다. // (18.07.30) GetInteraction 컴포넌트에서 획득된 객체의 TeleportSystem의 컴포넌트 도착지 좌표를 사용. // InteractionSystem의 자료형으로 조회 가능한지 테스트 필요. // -> 불가능, TeleportSystem의 자료형으로 참조해야한다. // playerInteraction의 현재 닿아있는 오브젝트의 TeleportSystem 컴포넌트 참조... if (!playerInteraction.triggerInteraction) { return; } TeleportSystem telSystem = playerInteraction.triggerInteraction.GetComponent <TeleportSystem>(); // 참조한 TeleprtSystem 컴포넌트의 도착지 좌표를 대입한다! y값은 +2.7f 상대좌표 //beyondCameraObj.transform.position = new Vector3(telSystem.Destination.transform.position.x, // telSystem.Destination.transform.position.y + 0.9f, -10); beyondCameraObj.transform.position = new Vector3(telSystem.Destination.transform.position.x, telSystem.Destination.transform.position.y - (telSystem.Destination.transform.position.y % 1.8f) - 0.9f, -10); playerCameraObj.transform.position = new Vector3(objPlayerInteraction.transform.position.x, objPlayerInteraction.transform.position.y - (objPlayerInteraction.transform.position.y % 1.8f) - 0.9f, -10); //playerCameraObj.transform.position = new Vector3(player.transform.position.x, // (player.transform.position.y + 1.8f) - ((player.transform.position.y + 1.8f) % 1.8f) - 0.9f, -10); // 현재 닿은 문과의 좌표계산, 필터의 알파값 제어 부분입니다 // .... }
/// <inheritdoc /> public override void OnPositionInputChanged(InputEventData <Vector2> eventData) { // Don't process input if we've got an active teleport request in progress. if (IsTeleportRequestActive) { return; } if (eventData.SourceId == InputSourceParent.SourceId && eventData.Handedness == Handedness && eventData.MixedRealityInputAction == teleportAction) { currentInputPosition = eventData.InputData; } if (Mathf.Abs(currentInputPosition.y) > inputThreshold || Mathf.Abs(currentInputPosition.x) > inputThreshold) { // Get the angle of the pointer input float angle = Mathf.Atan2(currentInputPosition.x, currentInputPosition.y) * Mathf.Rad2Deg; // Offset the angle so it's 'forward' facing angle += angleOffset; PointerOrientation = angle; if (!teleportEnabled) { float absoluteAngle = Mathf.Abs(angle); if (absoluteAngle < teleportActivationAngle) { teleportEnabled = true; TeleportSystem.RaiseTeleportRequest(this, TeleportHotSpot); } else if (canMove) { // wrap the angle value. if (absoluteAngle > 180f) { absoluteAngle = Mathf.Abs(absoluteAngle - 360f); } // Calculate the offset rotation angle from the 90 degree mark. // Half the rotation activation angle amount to make sure the activation angle stays centered at 90. float offsetRotationAngle = 90f - rotateActivationAngle; // subtract it from our current angle reading offsetRotationAngle = absoluteAngle - offsetRotationAngle; // if it's less than zero, then we don't have activation if (offsetRotationAngle > 0) { // check to make sure we're still under our activation threshold. if (offsetRotationAngle < rotateActivationAngle) { canMove = false; // Rotate the camera by the rotation amount. If our angle is positive then rotate in the positive direction, otherwise in the opposite direction. CameraCache.Main.transform.parent.RotateAround(CameraCache.Main.transform.position, Vector3.up, angle >= 0.0f ? rotationAmount : -rotationAmount); } else // We may be trying to strafe backwards. { // Calculate the offset rotation angle from the 180 degree mark. // Half the strafe activation angle to make sure the activation angle stays centered at 180f float offsetStrafeAngle = 180f - backStrafeActivationAngle; // subtract it from our current angle reading offsetStrafeAngle = absoluteAngle - offsetStrafeAngle; // Check to make sure we're still under our activation threshold. if (offsetStrafeAngle > 0 && offsetStrafeAngle < backStrafeActivationAngle) { canMove = false; var height = CameraCache.Main.transform.parent.position.y; var newPosition = -CameraCache.Main.transform.forward * strafeAmount + CameraCache.Main.transform.parent.position; newPosition.y = height; CameraCache.Main.transform.parent.position = newPosition; } } } } } } else { if (!canTeleport && !teleportEnabled) { // Reset the move flag when the user stops moving the joystick // but hasn't yet started teleport request. canMove = true; } if (canTeleport) { canTeleport = false; teleportEnabled = false; if (TeleportSurfaceResult == TeleportSurfaceResult.Valid || TeleportSurfaceResult == TeleportSurfaceResult.HotSpot) { TeleportSystem.RaiseTeleportStarted(this, TeleportHotSpot); } } if (teleportEnabled) { canTeleport = false; teleportEnabled = false; TeleportSystem.RaiseTeleportCanceled(this, TeleportHotSpot); } } if (teleportEnabled && TeleportSurfaceResult == TeleportSurfaceResult.Valid || TeleportSurfaceResult == TeleportSurfaceResult.HotSpot) { canTeleport = true; } }
/// <summary> /// Teleport location /// </summary> /// <param name="teleport">Teleport origin</param> public void Teleport(TeleportSystem teleport) { Teleport(teleport.To, teleport.name); }