Exemplo n.º 1
0
	// Use this for initialization
	void Start () {
		bool _isRight;
		
		_colidiu = false;
		//Capta o controlador de SFX - Para chamar as funcoes
		sfx = GameObject.FindGameObjectWithTag ("sfx").GetComponent<SFXController> ();
		
		_unit = GameObject.FindGameObjectWithTag ("GameMaker").GetComponent<UnitF2> ();
		_unit.procuraCasas ();
		_isRight = _unit.isRight();
		
		score = GameObject.FindGameObjectWithTag ("score").GetComponent<Score> ();
		_carregaPedra = CarregaPedra ();
		SetaPedra (_carregaPedra);
		
		
		
		
		
		if (gameObject.name == "Dragon-blue(Clone)") {
			_velocidade = _unit.velAzul ();
			danoPontuacao = 10;
			sfx.playHitBlue ();
		}
		if (gameObject.name == "dragonYellow(Clone)") {
			_velocidade = _unit.velAmarelo ();
			danoPontuacao = 20;
			sfx.playHitYel  ();
		}
		if (gameObject.name == "dragonBlack(Clone)") {
			_velocidade = _unit.velAmarelo ();
			danoPontuacao = 30;
		}
		
		if (_isRight) {
			
			GetComponent<Rigidbody2D>().velocity = new Vector2 (-_velocidade, 0);
		} else {
			transform.localScale = new Vector3 (-transform.localScale.x, transform.localScale.y, transform.localScale.z);
			GetComponent<Rigidbody2D>().velocity = new Vector2 (_velocidade, 0);
			
		}
	}