void Start() { NPCTargetPointsFound = GetComponentsInChildren<NPCTarget>(); if(NPCTargetPointsFound.Length > 0) { currentTarget = NPCTargetPointsFound[0]; currentPoint = 0; } }
// Use this for initialization new void Start() { base.Start(); gameObject.layer = LayerMask.NameToLayer("NPC"); Target = gameObject.GetComponent <NPCTarget>(); Rotation = gameObject.GetComponent <Rotate>(); CurrentTarget = transform.position; Vector3 forwardPosition = transform.position + Quaternion.Euler(new Vector3(0, 0, GetComponent <RotateTowardPosition>().rotationOffset) * -1) * (transform.up * -1); startingRotation = new Vector2(forwardPosition.x, forwardPosition.y); }
public void moveCurrentPoint() { if(currentPoint < NPCTargetPointsFound.Length -1) { currentPoint++; } else { currentPoint = 0; } currentTarget = NPCTargetPointsFound[currentPoint]; }