void DiagonalView() { transform.position = DIAGONAL_VEC; transform.LookAt(Vector3.zero); mode = STATIC; target = null; zoom_vec = DIAGONAL_ZOOM; }
void BirdsEyeView() { transform.position = BIRD_VEC; transform.LookAt(Vector3.zero); mode = STATIC; target = null; zoom_vec = BIRD_ZOOM; }
void MissileView() { // the distance behind the target float distance = 1.0f; // the height we want the camera to be above the target float height = 0.3f; if (target == null) { // find a random missile TODO: fix if (missile_destroyed == true) { missile_destroyed = false; SideView(); } else { GameObject obj = (GameObject)Instantiate(missile, transform.position, transform.rotation); target = obj.GetComponent<SimpleSeeking>(); missile_destroyed = true; } } // set the position of the camera transform.position = new Vector3(target.position.x, target.position.y + height, target.position.z + distance); // set the look at point //transform.LookAt(target.position + target.velocity, new Vector3(0,1,0)); transform.LookAt(target.position + target.velocity, target.transform.forward); // reorient the camera Quaternion reorient = Quaternion.LookRotation(transform.forward, new Vector3(0,1,0)); transform.rotation = reorient; mode = DYNAMIC; zoom_vec = transform.forward; }
// Use this for initialization void Start() { target = null; BirdsEyeView(); missile_destroyed = false; }
void SideView() { transform.position = SIDE_VEC; transform.LookAt(Vector3.zero); mode = STATIC; target = null; zoom_vec = SIDE_ZOOM; }