void Start() { _horseScript = GameObject.FindGameObjectWithTag ("Player").GetComponent<HorseCharacterController> (); }
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()); }
void Start() { _controller = GameObject.FindGameObjectWithTag ("Player").GetComponent<HorseCharacterController> (); _renderer = GetComponentInChildren<Renderer> (); _particle = transform.Find ("Particle"); }