示例#1
0
	void OnCollisionEnter(Collision collision)
	{
		//When collided with ally tower, ally tower disappears for now 
		if (collision.collider.gameObject.name.Contains("Ally Tower"))
		{
			tempScript = collision.collider.gameObject.GetComponent<AllyTowerScript>();
			tempScript.decreaseHealth(5f);
			this.transform.position += new Vector3 (0.5f, 0f, 0f);
		}
	}
示例#2
0
	// Use this for initialization
	void Start () {
		soundfx = GetComponent<AudioSource>();
		allyTowerScript = allyTower.GetComponent<AllyTowerScript> ();

		regMortyBtn = new mortyButton(regMortyButton);
		frozenMortyBtn = new mortyButton (frozenMortyButton);
		karateMortyBtn = new mortyButton (karateMortyButton);
		shadowMortyBtn = new mortyButton (shadowMortyButton);
		wrestlerMortyBtn = new mortyButton (wrestlerMortyButton);

		gold = 30;

		restartButton.gameObject.SetActive(false);
		waveText.enabled = false;
		StartCoroutine(spawnWave());

		//set the unlock message
		frozenMortyText = frozenMortyLabel.GetComponent<Text> ().text;
		frozenMortyLabel.GetComponent<Text>().text = "Unlock with " + 3*frozenMortyCost + "G\nFrozen Morty (2)\nSlow units for 2s \nWeak against Prax";

		karateMortyText = karateMortyLabel.GetComponent<Text> ().text;
		karateMortyLabel.GetComponent<Text>().text = "Unlock with " + 3*karateMortyCost + "G\nKarate Morty (3)\nHigh damage and Speed\nLow health ";

		shadowMortyText = shadowMortyLabel.GetComponent<Text> ().text;
		shadowMortyLabel.GetComponent<Text>().text = "Unlock with " + 3*shadowMortyCost + "G\nShadow Morty (4)\nAvoids small units\nWeak against Goob";

		wrestlerMortyText = wrestlerMortyLabel.GetComponent<Text> ().text;
		wrestlerMortyLabel.GetComponent<Text> ().text = "Unlock with " + 3*wrestlerMortyCost + "G\nWrestler Morty (5)\nHigh health\nSlow speed ";
	}