敵のBallが追いかけてくるようにする




ターゲットを追いかける
using UnityEngine;
using System.Collections;
public class Chase : MonoBehaviour {
public GameObject target;
private NavMeshAgent agent;
void Start () {
agent = GetComponent<NavMeshAgent>();
}
void Update () {
// 敵の目的地にターゲットの位置を設定する。
agent.destination = target.transform.position;
}
}








【旧版】BallGame(全25回)
他のコースを見る



ターゲットを追いかける
using UnityEngine;
using System.Collections;
public class Chase : MonoBehaviour {
public GameObject target;
private NavMeshAgent agent;
void Start () {
agent = GetComponent<NavMeshAgent>();
}
void Update () {
// 敵の目的地にターゲットの位置を設定する。
agent.destination = target.transform.position;
}
}








敵のBallが追いかけてくるようにする