public override void StartState() { this.GetController().GetData().actualLifePoints--; mainCamera = GameObject.Find ("Main Camera"); if (mainCamera == null) { throw new MissingReferenceException("Na sscenie brak GameObjecr Main Camera"); } cameraController=mainCamera.GetComponent<CameraController>(); if (cameraController == null) { throw new MissingReferenceException("Main Camera GameObject nie posiada komponentu CameraController"); } cameraController.isEnable = false; finishTime = Time.realtimeSinceStartup + finalCountdown; actualCountdown = (int)finishTime; bitmapText = new BitmapText (); bitmapText.setTextures (this.GetController().GetGuiAssets().digitsB); bitmapScore = new BitmapText (); bitmapScore.setTextures (this.GetController().GetGuiAssets().digitsB); boardObject = GameObject.Find ("Board"); if (boardObject == null) { throw new MissingReferenceException("Scena nie posiada Board GameObject"); } blockController=boardObject.GetComponent<BlockController>(); if (blockController == null) { throw new MissingReferenceException("Board GameObject nie posiada komponentu BlockController"); } playerObject = GameObject.Find ("Player"); if (playerObject == null) { throw new MissingReferenceException("Scena nie posiada PLayer GameObject"); } playerController=playerObject.GetComponent<PlayerController>(); if (playerController == null) { throw new MissingReferenceException("Player GameObject nie posiada komponentu PlayerController"); } blockController.TurnOff (); actualCountdown = (int)finishTime; // playerObject.transform.position=new Vector3(0,4,0); }
private void Init() { this.GetController().GetData ().countAllPlays = PlayerPrefs.GetInt ("countAllPlays"); this.GetController().GetData ().countAllPlays++; PlayerPrefs.SetInt ("countAllPlays",this.GetController().GetData ().countAllPlays); PlayerPrefs.Save(); this.GetController().GetData ().countActPlays++; Time.timeScale = 0; this.isInit = true; boardObject = GameObject.Find ("Board"); if (boardObject == null) { throw new MissingReferenceException("Scena nie posiada Board GameObject"); } boardBuilder=boardObject.GetComponent<BoardBuilder>(); if (boardBuilder == null) { throw new MissingReferenceException("Board GameObject nie posiada komponentu BoardBuilder"); } boardBuilder.Build (this.GetController().GetData().boardSize,this.GetController().GetData().blockWidth,this.GetController().GetData().blockHeight); finishTime = Time.realtimeSinceStartup + finalCountdown; bitmapText = new BitmapText (); bitmapText.setTextures (this.GetController().GetGuiAssets().digitsB); bitmapScore = new BitmapText (); bitmapScore.setTextures (this.GetController().GetGuiAssets().digitsB); actualCountdown = 0; this.GetController ().GetData ().actualLifePoints = this.GetController ().GetData ().startLifePoints; this.GetController ().GetData ().lastPointsLife = 0; this.GetController ().GetData ().actualScore = 0; this.GetController ().GetData ().actEnemyKilled = 0; this.GetController ().GetData ().actMaxHeight = 0; this.GetController ().GetData ().actMaxLifePoints = this.GetController ().GetData ().startLifePoints; AudioSource music = GameObject.Find ("Main Camera").GetComponent<AudioSource>(); if (this.GetController ().GetData ().isMusic == false) { music.enabled=false; }else{ music.enabled=true; music.volume = 0.1f; } actualCountdown = (int)finishTime; GameObject playerObject = GameObject.Find ("Player"); if(playerObject==null){ throw new MissingReferenceException("Brakuje GameObject Player"); } playerObject.transform.position=new Vector3(0,0.49f,0); }
public override void StartState() { bestScore = PlayerPrefs.GetInt ("BestScore"); bitmapText = new BitmapText (); bitmapText.SetText(bestScore.ToString()); bitmapText.setTextures (this.GetController().GetGuiAssets().digitsB); if (PlayerPrefs.GetInt ("MusicStatus") == 0) {//turn on 0 this.GetController().GetData().isMusic=true; }else{ this.GetController().GetData().isMusic=false; } if (PlayerPrefs.GetInt ("SoundStatus") == 0) {//turn on 0 this.GetController().GetData().isSound=true; }else{ this.GetController().GetData().isSound=false; } music = GameObject.Find ("Main Camera").GetComponent<AudioSource>(); if (this.GetController ().GetData ().isMusic == false) { music.enabled=false; }else{ music.enabled=true; music.volume = 0.25f; } if(this.GetController().GetData().showBanner==true){ Debug.Log("Próba wyświetlenia popapu !!!!"); this.GetController().GetData().showBanner=false; this.GetController().GetAd().ShowInterstitial(); }else{ this.GetController ().GetAd ().ShowBanner (); } }