using UnityEngine;
using System.Collections;
public class FollowPlayer : MonoBehaviour {
public Vector3 offset;//偏移量
private Transform player;//玩家
void Awake(){
//找到标签时“player”的游戏物体的位置
player = GameObject.FindGameObjectWithTag ("Player").transform;
}
// Update is called once per frame
void Update () {
//设置血条的位置,玩家的位置加偏移量
transform.position = player.position + offset;
}
}
2D 血条 跟随 玩家
最新推荐文章于 2017-05-20 17:25:06 发布