Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        thegame = (GameObject)Instantiate(test, transform.position, transform.rotation);
        EnnemyScript script1 = thegame.GetComponent <EnnemyScript> ();

        //EnnemyScript script2 = GetComponent<EnnemyScript> ();
    }
    void OnCollisionEnter2D(Collision2D collision)
    {
        bool damagePlayer = false;

        EnnemyScript ennemy = collision.gameObject.GetComponent <EnnemyScript> ();

        if (ennemy != null)
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 3
0
	void Spawn()
	{
		SpawnedEnnemy = (GameObject)Instantiate (Ennemy, transform.position, transform.rotation);
		SpawnedEnnemyScript = SpawnedEnnemy.GetComponent<EnnemyScript> ();
		SpawnedEnnemyScript.Level = EnnemyLevel + Random.Range (1, 2);
		SpawnedEnnemyScript.Strength = EnnemyStrength + Random.Range (1, 50);
		SpawnedEnnemyScript.Defense = EnnemyDefense + Random.Range (1, 10);
		SpawnedEnnemyScript.GiveXP = EnnemyXp + Random.Range (1, 10);
		SpawnedEnnemyScript.SpawnPoint = gameObject;
		//SpawnedEnnemy.transform.FindChild ("Contents") = GetComponent<EnnemyDrop> ().Contents;
		if (DropContent.Length > 0) {
			foreach (GameObject item in DropContent) {
				GameObject InstanciatedItem = Instantiate (item);
				InstanciatedItem.transform.parent = SpawnedEnnemy.transform.FindChild ("Contents");
			}
			SpawnedEnnemy.GetComponent<Chest> ().UpdateContent ();
		}
	}
Exemplo n.º 4
0
 void Spawn()
 {
     SpawnedEnnemy                  = (GameObject)Instantiate(Ennemy, transform.position, transform.rotation);
     SpawnedEnnemyScript            = SpawnedEnnemy.GetComponent <EnnemyScript> ();
     SpawnedEnnemyScript.Level      = EnnemyLevel + Random.Range(1, 2);
     SpawnedEnnemyScript.Strength   = EnnemyStrength + Random.Range(1, 50);
     SpawnedEnnemyScript.Defense    = EnnemyDefense + Random.Range(1, 10);
     SpawnedEnnemyScript.GiveXP     = EnnemyXp + Random.Range(1, 10);
     SpawnedEnnemyScript.SpawnPoint = gameObject;
     //SpawnedEnnemy.transform.FindChild ("Contents") = GetComponent<EnnemyDrop> ().Contents;
     if (DropContent.Length > 0)
     {
         foreach (GameObject item in DropContent)
         {
             GameObject InstanciatedItem = Instantiate(item);
             InstanciatedItem.transform.parent = SpawnedEnnemy.transform.FindChild("Contents");
         }
         SpawnedEnnemy.GetComponent <Chest> ().UpdateContent();
     }
 }