using UnityEngine;

using System.Collections;


public class ExFollow : MonoBehaviour {

public Transform[] Target = new Transform[2];

Vector3 diff;

int count = 0;

int index = 0;

// Use this for initialization

void Start () {

GetDiff();

}

void GetDiff(){

diff = Target[index].position - transform.position;

}

// Update is called once per frame

void Update () {

if(Input.GetKeyDown(KeyCode.Space) && index < Target.Length){

transform.position += diff * 0.1f;

count++;

if(count > 10){

count = 0;

index++;

GetDiff();

}

}

}

}




+ Recent posts