void OnCollisionEnter2D(Collision2D other) { /*if(activeObject == true) * { * if(other.gameObject.tag != "Floor") * { * //GameObject variable class * //gameObject anything that the script is attached to * Transform followThis = other.gameObject.transform; * mainCam.GetComponent<camera_follow>().followTransform = followThis; * * other.gameObject.GetComponent<get_hit>().activeObject = true; * //activeObject = false; * * Debug.Log(other.gameObject.GetComponent<get_hit>().activeObject); * * } * * } */ if (other.gameObject.tag == "hitThing" && !alreadyFollowed) { camScript = (camera_follow)cam.GetComponent(typeof(camera_follow)); camScript.followTransform = nextObj; alreadyFollowed = true; } }
public override void OnInspectorGUI() { DrawDefaultInspector(); camera_follow cf = (camera_follow)target; if (GUILayout.Button("Set Min Cam Pos")) { cf.SetMinCamPosition(); } if (GUILayout.Button("Set Max Cam Pos")) { cf.SetMaxCamPosition(); } }
void Start() { scriptCamera = camera.GetComponent <camera_follow>(); }