NVIDIA / DeepLearningExamples

State-of-the-Art Deep Learning scripts organized by models - easy to train and deploy with reproducible accuracy and performance on enterprise-grade infrastructure.
13.59k stars 3.24k forks source link

Game realista estilo clash of clans #1412

Open felipeliliti opened 3 months ago

felipeliliti commented 3 months ago

// Script básico para construção de um edifício

public class Building : MonoBehaviour { public int health; public int buildCost; public int buildTime; public GameObject constructionEffect;

private bool isBuilding = false;

void Start()
{
    // Inicia a construção do edifício
    StartCoroutine(Build());
}

IEnumerator Build()
{
    isBuilding = true;
    GameObject effect = Instantiate(constructionEffect, transform.position, Quaternion.identity);
    yield return new WaitForSeconds(buildTime);
    Destroy(effect);
    isBuilding = false;
}

void TakeDamage(int damage)
{
    health -= damage;
    if (health <= 0)
    {
        // Logica para destruir o edifício
        Destroy(gameObject);
    }
}

}