unity中怎么用JS修改其他脚本的变量
展开全部
var HP : PLAYERHP;
function Start () {
HP = GameObject.Find("PLAYER-HP").GetComponent(PLAYERHP);
}
function Update () {
}
function OnParticleCollision (other : GameObject) {
if (other.gameObject.tag == "WALL-ATTACK")
{
HP.Health = HP.Health - 5;
//此脚本侦测到粒子碰撞时PLAYERHP里的Health变量减5~~
print(HP.Health);
//显示PLAYERHP里的Health变量~~
}
}
function Start () {
HP = GameObject.Find("PLAYER-HP").GetComponent(PLAYERHP);
}
function Update () {
}
function OnParticleCollision (other : GameObject) {
if (other.gameObject.tag == "WALL-ATTACK")
{
HP.Health = HP.Health - 5;
//此脚本侦测到粒子碰撞时PLAYERHP里的Health变量减5~~
print(HP.Health);
//显示PLAYERHP里的Health变量~~
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询