Пример #1
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     viewController = collision.GetComponent <VeiwController>();
     if (viewController != null)
     {
         viewController.IsCaptured = false;
         viewController            = null;
     }
 }
Пример #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        viewController = collision.GetComponent <VeiwController>();
        if (viewController != null)
        {
            viewController.IsCaptured = true;

            var quest = Quest.GetComponent <IQuest>();
            if (quest != null)
            {
                quest.RunQuest();
            }
        }
    }
Пример #3
0
    void Update()
    {
        if (!isOpening)
        {
            return;
        }

        left.transform.position  += speed * Time.deltaTime * Vector3.left;
        right.transform.position += speed * Time.deltaTime * Vector3.right;

        if ((right.transform.position - left.transform.position).magnitude > 2 * SideSize)
        {
            isOpening = false;
            GetComponent <Collider2D>().enabled = false;
            if (viewController != null)
            {
                viewController.IsCaptured = false;
                viewController            = null;
            }
        }
    }