Exemple #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag.Contains("PlayerHitbox"))
     {
         spawning.DestroyEntity(gameObject);
     }
 }
Exemple #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag.Contains("Finish"))
        {
            gameObject.GetComponent <Rigidbody>().velocity        = Vector3.zero;
            gameObject.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;
            gameObject.transform.Find("meteor").gameObject.SetActive(false);
            gameObject.transform.Find("Impact").gameObject.SetActive(true);
            gameObject.transform.Find("Impact").Find("ImpactSparks").GetComponent <ParticleSystem>().Play();
            gameObject.transform.Find("Impact").Find("Smokering").GetComponent <ParticleSystem>().Play();
            gameObject.transform.Find("Impact").Find("Debris").GetComponent <ParticleSystem>().Play();

            Spawning          spawning = GameObject.Find("Terrain").GetComponent <Spawning>();
            List <GameObject> kill     = new List <GameObject>();
            foreach (GameObject enemy in spawning.enemiesList)
            {
                if ((enemy.gameObject.transform.position - gameObject.transform.position).magnitude <= 4)
                {
                    kill.Add(enemy);
                }
            }

            foreach (GameObject enemy in kill)
            {
                spawning.DestroyEntity(enemy);
            }
            Destroy(gameObject, 2f);
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        GameObject.Find("Console").GetComponent <Console>().Print("BAM");
        Spawning spawning = GameObject.Find("Terrain").GetComponent <Spawning>();

        if (other.tag.Contains("EnemyHitbox"))
        {
            Debug.Log("shit");
            spawning.DestroyEntity(other.GetComponent <MainHitbox>().enemyGameObject.transform.parent.gameObject);
        }
    }