using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Waypoints : MonoBehaviour {
public Transform[] waypoint;
public float patrolSpeed;
public bool loop = true;
public int dampingLook = 4;
public float pauseDuration;
private float curTime;
private int currentWaypoint = 0;
public CharacterController character;
// Use this for initialization
void Start() {
}
void LateUpdate(){
if(currentWaypoint < waypoint.Length){
patrol();
}else{
if(loop){
currentWaypoint= 0;
}
}
}
void patrol(){
Vector3 nextWayPoint = waypoint[currentWaypoint].position;
// Keep waypoint at character's height
nextWayPoint.y = transform.position.y;
// Get the direction we need to move to
// reach the next waypoint
Vector3 moveDirection = nextWayPoint - transform.position;
文字を意味する変換ですか?だからtransform.positionはこの場合の文字位置を取得しますThirdPersonController私はそれにスクリプトを追加しましたか?スクリプトが文字への変換に属していることをどのように知っていますか?トランスフォームとは何か、トランスフォームとは何ですか?
Transform _transformを実行している場合、_transformと現在使用している変換の違いは何ですか?
たとえば、文字の開始位置を設定または取得する場合は、スクリプトで行うことができます。public Transform _transform;次に、start関数で:_transform = GetComponent();例えば、私は_transformから位置を得ることができますか?
:あなたが使用することができ、あなたの文字の位置を設定するには :
はEDIT:しかし、我々はまだ、実際の参照を取得し、少なくとも一度に変換呼び出す必要がありますタグ。 – spender
実際、SOは「チュートリアル」指向のサイトではありません。 – Fattie
何らかの理由でアンダースコアを含む変数名を使用することはありません。 – Fattie