IEnumerator InitializeAvatarController() { if (!defaultAvatarInstance.IsLoaded) { Logger.Debug("Waiting for avatar to load"); yield return(new WaitWhile(delegate() { return !defaultAvatarInstance.IsLoaded; })); } else { yield return(null); } Logger.Debug("Spawning avatar"); _centerAdjust = FindObjectOfType <VRCenterAdjust>(); avatar = AvatarSpawner.SpawnAvatar(defaultAvatarInstance, this); playerNameText = CreateWorldText(transform, "Loading"); playerNameText.rectTransform.anchoredPosition3D = new Vector3(0f, 0.25f, 0f); playerNameText.alignment = TextAlignmentOptions.Center; playerNameText.fontSize = 2.5f; avatar.GameObject.transform.SetParent(_centerAdjust.transform, false); transform.SetParent(_centerAdjust.transform, false); }
IEnumerator WaitForControllers() { Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("Waiting for game controllers..."); yield return(new WaitUntil(delegate() { return FindObjectOfType <ScoreController>() != null; })); Console.WriteLine("Controllers found!"); _gameManager = Resources.FindObjectsOfTypeAll <GameplayManager>().First(); if (_gameManager != null) { try { if (ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger") != null) { ReflectionUtil.GetPrivateField <IPauseTrigger>(_gameManager, "_pauseTrigger").SetCallback(delegate() { }); } if (ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper") != null) { ReflectionUtil.GetPrivateField <VRPlatformHelper>(_gameManager, "_vrPlatformHelper").inputFocusWasCapturedEvent -= _gameManager.HandleInputFocusWasCaptured; } } catch (Exception e) { Console.WriteLine(e.ToString()); } } Console.WriteLine("Disabled pause button"); _scoreController = FindObjectOfType <ScoreController>(); if (_scoreController != null) { _scoreController.scoreDidChangeEvent += ScoreChanged; _scoreController.noteWasCutEvent += noteWasCutEvent; _scoreController.comboDidChangeEvent += comboDidChangeEvent; } Console.WriteLine("Found score controller"); _energyController = FindObjectOfType <GameEnergyCounter>(); if (_energyController != null) { _energyController.gameEnergyDidChangeEvent += EnergyDidChangeEvent; } Console.WriteLine("Found energy controller"); _roomAdjust = FindObjectOfType <VRCenterAdjust>(); if (_roomAdjust != null) { roomPositionOffset = _roomAdjust.transform.position; roomRotationOffset = _roomAdjust.transform.rotation; } }
IEnumerator GrabRequired() { yield return(new WaitUntil(() => BS_Utils.Plugin.LevelData.IsSet)); yield return(new WaitUntil(() => Resources.FindObjectsOfTypeAll <ScoreController>().Any())); _scoreController = Resources.FindObjectsOfTypeAll <ScoreController>().FirstOrDefault(); _vrca = Resources.FindObjectsOfTypeAll <VRCenterAdjust>().FirstOrDefault(); Init(); }
IEnumerator InitializeAvatarController() { if (!defaultAvatarInstance.IsLoaded) { #if DEBUG Plugin.log.Info("Waiting for avatar to load"); #endif yield return(new WaitWhile(delegate() { return !defaultAvatarInstance.IsLoaded; })); } else { yield return(null); } #if DEBUG Plugin.log.Info("Spawning avatar"); #endif centerAdjust = FindObjectOfType <VRCenterAdjust>(); avatar = AvatarSpawner.SpawnAvatar(defaultAvatarInstance, this); exclusionScript = avatar.GameObject.GetComponentsInChildren <AvatarScriptPack.FirstPersonExclusion>().FirstOrDefault(); if (exclusionScript != null) { exclusionScript.SetVisible(); } playerNameText = CustomExtensions.CreateWorldText(transform, "INVALID"); playerNameText.rectTransform.anchoredPosition3D = new Vector3(0f, 0.25f, 0f); playerNameText.alignment = TextAlignmentOptions.Center; playerNameText.fontSize = 2.5f; playerSpeakerIcon = new GameObject("Player Speaker Icon", typeof(Canvas), typeof(CanvasRenderer)).AddComponent <Image>(); playerSpeakerIcon.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace; playerSpeakerIcon.rectTransform.SetParent(transform); playerSpeakerIcon.rectTransform.localScale = new Vector3(0.004f, 0.004f, 1f); playerSpeakerIcon.rectTransform.pivot = new Vector2(0.5f, 0.5f); playerSpeakerIcon.rectTransform.anchoredPosition3D = new Vector3(0f, 0.65f, 0f); playerSpeakerIcon.sprite = Sprites.speakerIcon; avatar.GameObject.transform.SetParent(centerAdjust.transform, false); transform.SetParent(centerAdjust.transform, false); if (ModelSaberAPI.cachedAvatars.Any(x => x.Value == avatar.CustomAvatar)) { currentAvatarHash = ModelSaberAPI.cachedAvatars.First(x => x.Value == avatar.CustomAvatar).Key; } else { currentAvatarHash = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"; } }
IEnumerator WaitForGameData() { Console.ForegroundColor = ConsoleColor.Gray; yield return(new WaitUntil(delegate() { return Resources.FindObjectsOfTypeAll <MainGameSceneSetupData>().Count() > 0; })); _mainGameSceneSetupData = Resources.FindObjectsOfTypeAll <MainGameSceneSetupData>().First(); _roomAdjust = FindObjectOfType <VRCenterAdjust>(); if (_roomAdjust != null) { roomPositionOffset = _roomAdjust.transform.position; roomRotationOffset = _roomAdjust.transform.rotation; } }
void InitializeAvatarController() { #if DEBUG Plugin.log.Info("Spawning avatar"); #endif centerAdjust = GameObject.FindObjectOfType <VRCenterAdjust>(); avatarInput = new MultiplayerAvatarInput(); avatar = AvatarManager.SpawnAvatar(defaultAvatarInstance, avatarInput); /* * exclusionScript = avatar.GameObject.GetComponentsInChildren<AvatarScriptPack.FirstPersonExclusion>().FirstOrDefault(); * if (exclusionScript != null) * exclusionScript.SetVisible(); */ playerNameText = CustomExtensions.CreateWorldText(transform, "INVALID"); playerNameText.rectTransform.anchoredPosition3D = new Vector3(0f, 0.25f, 0f); playerNameText.alignment = TextAlignmentOptions.Center; playerNameText.fontSize = 2.5f; playerSpeakerIcon = new GameObject("Player Speaker Icon", typeof(Canvas), typeof(CanvasRenderer)).AddComponent <Image>(); playerSpeakerIcon.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace; playerSpeakerIcon.rectTransform.SetParent(transform); playerSpeakerIcon.rectTransform.localScale = new Vector3(0.004f, 0.004f, 1f); playerSpeakerIcon.rectTransform.pivot = new Vector2(0.5f, 0.5f); playerSpeakerIcon.rectTransform.anchoredPosition3D = new Vector3(0f, 0.65f, 0f); playerSpeakerIcon.sprite = Sprites.speakerIcon; avatar.eventsPlayer.gameObject.transform.SetParent(centerAdjust.transform, false); transform.SetParent(centerAdjust.transform, false); if (ModelSaberAPI.cachedAvatars.Any(x => x.Value.fullPath == avatar.customAvatar.fullPath)) { currentAvatarHash = ModelSaberAPI.cachedAvatars.First(x => x.Value.fullPath == avatar.customAvatar.fullPath).Key; } else { currentAvatarHash = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"; } }
IEnumerator InitializeReplayManager() { if (!defaultAvatar.IsLoaded) { Logger.Debug("Waiting for avatar to load"); yield return(new WaitWhile(delegate() { return !defaultAvatar.IsLoaded; })); } else { yield return(null); } Logger.Debug("Spawning avatar"); _centerAdjust = FindObjectOfType <VRCenterAdjust>(); avatar = AvatarSpawner.SpawnAvatar(defaultAvatar, this); avatar.GameObject.transform.SetParent(_centerAdjust.transform, false); transform.SetParent(_centerAdjust.transform, false); InvokeRepeating("MovementPlay", 0f, UPDATE_INTERVAL); }
IEnumerator InitializeAvatarController() { if (!defaultAvatarInstance.IsLoaded) { #if DEBUG Misc.Logger.Info("Waiting for avatar to load"); #endif yield return(new WaitWhile(delegate() { return !defaultAvatarInstance.IsLoaded; })); } else { yield return(null); } #if DEBUG Misc.Logger.Info("Spawning avatar"); #endif _centerAdjust = FindObjectOfType <VRCenterAdjust>(); avatar = AvatarSpawner.SpawnAvatar(defaultAvatarInstance, this); exclusionScript = avatar.GameObject.GetComponentsInChildren <AvatarScriptPack.FirstPersonExclusion>().FirstOrDefault(); if (exclusionScript != null) { exclusionScript.SetVisible(); } playerNameText = CustomExtensions.CreateWorldText(transform, "INVALID"); playerNameText.rectTransform.anchoredPosition3D = new Vector3(0f, 0.25f, 0f); playerNameText.alignment = TextAlignmentOptions.Center; playerNameText.fontSize = 2.5f; avatar.GameObject.transform.SetParent(_centerAdjust.transform, false); transform.SetParent(_centerAdjust.transform, false); currentAvatarHash = ModelSaberAPI.cachedAvatars.First(x => x.Value == avatar.CustomAvatar).Key; }