从另一个脚本访问变量/函数
Enemy_Stats
& Character_Stats
void OnCollisionEnter(Collision collision){ if (collision.gameObject.tag == "Enemy") { collision.gameObject.GetComponent<Enemy_Stats>().Health = collision.gameObject.GetComponent<Enemy_Stats>().Health - gameObject.GetComponent<Character_Stats>().AttackDamage; if (collision.gameObject.GetComponent<Enemy_Stats>().Health <= 0) { Destroy(collision.gameObject); } }}
collision.Health
?
湖上湖
桃花长相依
翻翻过去那场雪
相关分类