Exemplo n.º 1
0
    void Awake()
    {
        current = this;

        materials = new Material[nMaterials];

        for (int i = 0; i < nMaterials; i++)
        {
            var mat = Instantiate(material);
            mat.color    = Color.Lerp(material.color, Color.red, 1f / nMaterials * (nMaterials - i));
            materials[i] = mat;
        }
    }
Exemplo n.º 2
0
    public void TakeDamage(float damage)
    {
        link.SetDamage(damage);
        var t_material = HealthMaterials.GetMaterial(link.health);

        if (material != t_material)
        {
            material = t_material;
            for (int i = 0; i < 0; i++)
            {
                self[i].material = material;
            }
        }
    }
Exemplo n.º 3
0
    void DamageHull(float damage)
    {
        health -= damage;
        if (health < 0)
        {
            health = 0;
        }

        shipDriver.OnDamaged(damage);

        var t_material = HealthMaterials.GetMaterial(health / maxHealth);

        if (material != t_material)
        {
            material = t_material;
            GetComponent <Renderer>().material = material;
        }
    }