示例#1
0
    public void Damage(int amount)
    {
        Health -= amount;

        if (Health < MaxHealth * 0.5f)
        {
            CurrentDestruction = DestructionLevel.PARTIAL;
            tiny_flames.SetActive(true);
            if (mesh_renderer != null)
            {
                mesh_renderer.material = damaged_1;
            }
        }
        if (Health < MaxHealth * 0.25f)
        {
            CurrentDestruction = DestructionLevel.SEVERE;
            medium_flames.SetActive(true);
            if (mesh_renderer != null)
            {
                mesh_renderer.material = damaged_2;
            }
        }
        if (Health <= 0)
        {
            CurrentDestruction = DestructionLevel.DESTROYED;
        }
    }
示例#2
0
        private GameObject SetDestructionLvl(DestructionLevel level)
        {
            foreach (var mesh in destructLvlMeshes)
            {
                mesh.SetActive(false);
            }

            var meshGameObject = destructLvlMeshes[(int)level];

            meshGameObject.SetActive(true);
            return(meshGameObject);
        }