Пример #1
0
    void OnTriggerEnter(Collider collision)
    {
        if (collision.gameObject.name == "Earth")
        {
            EarthLife lifeScript = collision.gameObject.GetComponent <EarthLife>();
            lifeScript.dealDamage();
            Destroy(gameObject);
        }
        else if (collision.gameObject.name.Equals("shield"))
        {
            Destroy(gameObject);
        }
        else if (collision.gameObject.name.Equals("Player"))
        {
/*Energy energy = collision.gameObject.GetComponent<Energy>();
 * energy.dealDamage();
 * Split();*/
        }
        else
        {
            Split();
        }
    }
Пример #2
0
    void Update()
    {
        EarthLife lifeScript = earth.GetComponent <EarthLife>();

        barDisplay = lifeScript.getMyLife();
    }