using UnityEngine;
using System.Collections;
public class CameraFollow : MonoBehaviour {
public GameObject target;
public GameObject enemy;
TargetController myTargetController;
float velocity=0.0f;
float newPositionX;
// Update is called once per frame
void Update () {
//Camera Move
if(target.transform.position.x>0 &&
target.transform.position.x<33.5)
{
newPositionX=Mathf.SmoothDamp(transform.position.x,target.transform.position.x, ref velocity, 1.0f);
transform.position=new Vector3(newPositionX, transform.position.y, transform.position.z);
}
//Active object when reach to a position
if (transform.position.x > 2.8f) {
if(enemy!=null){
enemy.SetActive(true);
}
}
}
}
No comments:
Post a Comment