public override void Start() { base.Start (); if (InGameMenuGUI.music == null) { InGameMenuGUI.music = (GameObject)Instantiate (musicObject); InGameMenuGUI.music.audio.clip = music; InGameMenuGUI.music.audio.Play (); } _characterWidget = GameObject.Find("CharacterWidget").GetComponent<CharacterWidgetScript> (); float __width = Screen.width / 2; Transform __finishPosition = GameObject.Find ("FinishLine").transform; _progressBar = new Rect (0, 0, progressBarLength, 25); _progressBar.center = new Vector2 (__width, 25); _playerPosition = _player.transform; _birdPosition = GameObject.Find ("Bird").transform; _levelLength = __finishPosition.position.x - _player.transform.position.x; _progressPlayerPos = new Rect (0, 0, progressCharacterSize, progressCharacterSize); _progressPlayerPos.center = new Vector2 (0, 25); _progressBirdPos = new Rect (0, 0, progressCharacterSize, progressCharacterSize); _progressBirdPos.center = new Vector2 (0, 25); gameObject.AddComponent<GUIText> (); gameObject.transform.position = new Vector3 (0.5f, 0.5f, 0); guiText.font = (Font)Resources.Load ("Fonts/Gretoon"); guiText.fontSize = 60; guiText.alignment = TextAlignment.Center; guiText.anchor = TextAnchor.MiddleCenter; _horseScript = _player.GetComponent<HorseCharacterController> (); foreach (var anim in _horseScript.GetComponentsInChildren<Animation2D>()) { if (anim.animName == _horseScript._idleAnim) { _playerTexture = anim.frames; break; } } StartCoroutine(_InitiateCountdown()); }
// Use this for initialization public override void Start() { base.Start (); _diffuse = Shader.Find ("Transparent/Diffuse"); _audioSource = GetComponent<AudioSource> (); _characterWidget = GameObject.Find("CharacterWidget").GetComponent<CharacterWidgetScript>(); _harakka = GameObject.Find ("Harakka").GetComponent<HarakkaScript>(); switch(Manager.GetCharacter()) { case Character.Blonde: _player = Instantiate(blonde) as GameObject; break; case Character.Boy: _player = Instantiate(boy) as GameObject; break; case Character.Fox: _player = Instantiate(fox) as GameObject; break; case Character.Brune: _player = Instantiate(brune) as GameObject; break; default: _player = Instantiate(blonde) as GameObject; break; } _player.SetActive (false); if (InGameMenuGUI.music == null) { InGameMenuGUI.music = (GameObject)Instantiate (musicObject); InGameMenuGUI.music.audio.clip = music; InGameMenuGUI.music.audio.Play (); InGameMenuGUI.music.audio.loop = true; } Vector3 __worldSize = Camera.main.ScreenToWorldPoint (new Vector3 (Screen.width - 150, Screen.height, 0)); _worldWidth = __worldSize.x; _worldHeight = __worldSize.y; _counterStyle.font = (Font)Resources.Load ("Fonts/Gretoon"); _counterStyle.fontSize = 50; _counterStyle.normal.textColor = Color.white; _counterStyle.alignment = TextAnchor.MiddleCenter; _level = currentLevel - 1; SetGameState(GameState.Tutorial); StartCoroutine (WaitForTutorial()); }