Ejemplo n.º 1
0
    public void Spawn1()
    {
        GameObject spawn = Instantiate(musuh, spwn1.transform.position, Quaternion.identity) as GameObject;
        musuh      x     = spawn.GetComponent <musuh>();

        x.SetHealth();
    }
Ejemplo n.º 2
0
    IEnumerator SpawnCycle1()
    {
        if (!gamemanager.paused)
        {
            if (gamemanager.newgame == true)
            {
                yield return(new WaitForSeconds(Random.Range(1f, 2f)));

                gamemanager.newgame = false;
            }
            GameObject spawn = Instantiate(musuh, child1.transform.position, Quaternion.identity) as GameObject;
            musuh      x     = spawn.GetComponent <musuh>();
            x.SetHealth();
            if (gamemanager.score % 150 == 0)
            {
                //kalau skor udh sampai 50, interval berkurang
                if (interval1 <= 0.7f)
                {
                    interval1 = 0.7f;
                }
                else
                {
                    interval1 -= 0.15f;
                }
            }
        }
        yield return(new WaitForSeconds(interval1 + Random.Range(0f, 0.5f)));

        StartCoroutine(SpawnCycle1());
    }
Ejemplo n.º 3
0
    public IEnumerator Spawn4()
    {
        yield return(new WaitForSeconds(Random.Range(0f, 1f)));

        GameObject spawn = Instantiate(musuh, spwn4.transform.position, Quaternion.identity) as GameObject;
        musuh      x     = spawn.GetComponent <musuh>();

        x.SetHealth();
    }
Ejemplo n.º 4
0
    void OnTriggerEnter2D(Collider2D Info)
    {
        if (Info.transform.tag == "Enemy")
        {
            Debug.Log(Info.name);
            musuh mus = Info.GetComponent <musuh>();
            if (mus != null)
            {
                mus.TakeDamage(demage);
            }
            Destroy(gameObject);
        }
        else if (Info.transform.tag == "Tembak")
        {
            Debug.Log("OOt");
            Destroy(gameObject);
        }
        //Debug.Log (Info.name);
//		musuh mus = Info.GetComponent<musuh>();
//		if (mus != null) {
//			mus.TakeDamage (demage);
//		}
//		Destroy (gameObject);
    }