void Start() { blockGroup = new BlockGroup (); boardBuilder=GetComponent<BoardBuilder>(); if(boardBuilder==null){ throw new MissingReferenceException("GameObject "+gameObject.name+" nie ma komponentu BoardBuilder"); } newBoardRows = 0; isInit = false; enemyList = new List<Transform> (); }
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); }