Example #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player" && isOpen == true)
     {
         collision.transform.position = new Vector2(findPosition.X, findPosition.Y);
         TestMovement t = collision.gameObject.GetComponent <TestMovement>();
         parent = exitPoint.transform.parent.gameObject;
         collision.transform.parent = parent.transform;
         parent.transform.TransformPoint(Vector3.zero);
         GameObject    middle = parent.transform.Find("Mid").gameObject;
         GameObject    camera = GameObject.Find("Main Camera");
         Camera_script s      = camera.GetComponent <Camera_script>();
         s.target = new Vector3(middle.transform.position.x, middle.transform.position.y, -10);
         StartCoroutine(camera.GetComponent <Camera_script>().Transition());
         t.passing();
     }
 }
Example #2
0
 void FixedUpdate()
 {
     if (Input.GetKeyDown(KeyCode.E) && active && player.transform.parent.name == roomName && E.activeSelf && timer < 0)
     {
         TestMovement t = player.gameObject.GetComponent <TestMovement>();
         player.transform.position = new Vector2(findPosition.X, findPosition.Y);
         parent = exitPoint.transform.parent.gameObject;
         player.transform.parent = parent.transform;
         parent.transform.TransformPoint(Vector3.zero);
         GameObject    middle = parent.transform.Find("Mid").gameObject;
         GameObject    camera = GameObject.Find("Main Camera");
         Camera_script s      = camera.GetComponent <Camera_script>();
         //s.target = parent.transform;
         s.target = new Vector3(middle.transform.position.x, middle.transform.position.y, -10);
         //camera.target = parent;
         StartCoroutine(camera.GetComponent <Camera_script>().Transition());
         t.passing();
     }
 }