Esempio n. 1
0
        private void loadOre(OreDataJson oreData)
        {
            OreData ore = oreData.ore;

            ResourceManager.AddOre(
                ore.id,
                Sprite.Single(ResourceManager.GetTexture(ore.textureName),
                              Vector2.One),
                ore.name,
                ore.hardness,
                (float)ore.endurance,
                ResourceManager.GetItemByID(ore.dropId),
                (ore.color[0] * 0.01f, ore.color[1] * 0.01f, ore.color[2] * 0.01f),
                (float)ore.exp);
        }
Esempio n. 2
0
    void OnTriggerEnter(Collider col)
    {
        //Takes damage when hit by a projectile
        if (col.gameObject.tag == "Projectile")
        {
            health -= col.GetComponent <Projectile>().GetDamage();

            Destroy(col.gameObject);

            //TODO Add an effect to the distruction of the asteroids, so they don't just blink out of existence.
            if (health <= 0)
            {
                resourceManager.AddOre(ore);
                Destroy(gameObject);
            }
        }

        //Destroys the ship
        if (col.gameObject.tag == "Ship" && Ship.isDestroyed == false)
        {
            Ship.isDestroyed = true;
        }
    }