//initialize variables IEnumerator Start() { //on non-mobile devices hide joystick controls, except in editor #if !UNITY_EDITOR && (UNITY_STANDALONE || UNITY_WEBGL) ToggleControls(false); #endif //on mobile devices enable additional aiming indicator #if !UNITY_EDITOR && !UNITY_STANDALONE && !UNITY_WEBGL if (aimIndicator != null) { Transform indicator = Instantiate(aimIndicator).transform; indicator.SetParent(GameManager.GetInstance().localPlayer.shotPos); indicator.localPosition = new Vector3(0f, 0f, 3f); } #endif //play background music AudioManager.PlayMusic(1); //don't continue Everyplay initialization on non-supported devices if (!UnityEveryplayManager.IsRecordingSupported()) { yield break; } //set thumbnail used by Everyplay to our image reference, start recording and //immediately take a snapshot to be displayed as thumbnail after a short delay //this is because Unity Everyplay seems to need some time to initialize properly UnityEveryplayManager.InitializeThumbnail(thumbnailImage); UnityEveryplayManager.StartRecord(); yield return(new WaitForSeconds(0.5f)); UnityEveryplayManager.TakeThumbnail(); }
//initialize variables IEnumerator Start() { if (PlayerPrefs.HasKey(PrefsKeys.cameradistance) || PlayerPrefs.HasKey(PrefsKeys.cameraheight)) { OnCameraHeightChanged(PlayerPrefs.GetFloat(PrefsKeys.cameraheight)); OnCameraDistanceChanged(PlayerPrefs.GetFloat(PrefsKeys.cameradistance)); } else { OnCameraHeightChanged(camera.height); OnCameraDistanceChanged(camera.distance); } //get music and effect musicToggle.isOn = bool.Parse(PlayerPrefs.GetString(PrefsKeys.playMusic)); volumeSlider.value = PlayerPrefs.GetFloat(PrefsKeys.appVolume); OnMusicChanged(musicToggle.isOn); OnVolumeChanged(volumeSlider.value); BotSpawner.ChangElement.AddListener(ChangElement); BotSpawner.OnupStatusplayer.AddListener(ButtonStatusOn); TimeWave_S.maxValue = botspawn.TimeWave; LevelWave_S.maxValue = 25; //on non-mobile devices hide joystick controls, except in editor #if !UNITY_EDITOR && (UNITY_STANDALONE || UNITY_WEBGL) ToggleControls(false); #endif //on mobile devices enable additional aiming indicator // #if !UNITY_EDITOR && !UNITY_STANDALONE && !UNITY_WEBGL****************************** // if (aimIndicator != null) // { // Transform indicator = Instantiate(aimIndicator).transform; // indicator.SetParent(GameManager.GetInstance().localPlayer.shotPos); // indicator.localPosition = new Vector3(0f, 0f, 3f); // } // #endif //play background music AudioManager.PlayMusic(1); //don't continue Everyplay initialization on non-supported devices if (!UnityEveryplayManager.IsRecordingSupported()) { yield break; } //set thumbnail used by Everyplay to our image reference, start recording and //immediately take a snapshot to be displayed as thumbnail after a short delay //this is because Unity Everyplay seems to need some time to initialize properly UnityEveryplayManager.InitializeThumbnail(thumbnailImage); UnityEveryplayManager.StartRecord(); yield return(new WaitForSeconds(0.5f)); UnityEveryplayManager.TakeThumbnail(); }
protected virtual void RpcRespawn() { //toggle visibility for player gameobject (on/off) gameObject.SetActive(!gameObject.activeInHierarchy); bool isActive = gameObject.activeInHierarchy; //the player has been killed if (!isActive) { //detect whether the current user was responsible for the kill //yes, that's my kill: take thumbnail via EveryPlay if (killedBy == GameManager.GetInstance().localPlayer.gameObject) { UnityEveryplayManager.TakeThumbnail(); } if (explosionFX) { //spawn death particles locally using pooling and colorize them in the player's team color GameObject particle = PoolManager.Spawn(explosionFX, transform.position, transform.rotation); ParticleColor pColor = particle.GetComponent <ParticleColor>(); if (pColor) { pColor.SetColor(GameManager.GetInstance().teams[GetView().GetTeam()].material.color); } } //play sound clip on player death if (explosionClip) { AudioManager.Play3D(explosionClip, transform.position); } } //further changes only affect the local client if (!photonView.isMine) { return; } //local player got respawned so reset states if (isActive == true) { ResetPosition(); } else { //local player was killed, set camera to follow the killer camFollow.target = killedBy.transform; //hide input controls and other HUD elements camFollow.HideMask(true); //display respawn window (only for local player) GameManager.GetInstance().DisplayDeath(); } }