Example #1
0
    private void Update()
    {
        if (!ICon)
        {
            PlayerMove();

            if (Input.GetKeyDown(KeyCode.Space))
            {
                ShortDistance = 99999999;
                maxArr        = partner.Length;
                for (int i = 0; i < 3; i++)
                {
                    Distance = gameObject.transform.position - partner[i].transform.position;

                    if (Distance.magnitude < ShortDistance)
                    {
                        ShortDistance = Distance.magnitude;
                        SelectPartner = i;
                        shortDis      = partner[i];
                    }
                }

                if (ShortDistance < 5)//일정 거리 이하. 대화 가능.
                {
                    Debug.Log("대화");
                    daehwachang.SetStart(true);
                    daehwachang.SetPartner(partner[SelectPartner]);
                    ICon = true;
                }
            }
        }
    }