예제 #1
0
    // Update is called once per frame
    private void Update()
    {
        if (Rec == false)
        {
            if (MainBox == null)
            {
                Collider[] col = Physics.OverlapSphere(this.transform.position, 1f);
                int        i   = 0;
                while (i < col.Length)
                {
                    if (col[i].transform.gameObject.tag == "MainBox")
                    {
                        MainBox = col[i].transform.gameObject.GetComponent <BoxController>();
                        MainBox.boxSides.Add(this.transform.gameObject);
                    }
                }
            }
            else
            {
                //Vector3 dir = this.transform.position - MainBox.transform.position;

                //// Debug.DrawLine(this.transform.position, MainBox.transform.position);
                //Debug.DrawRay(this.transform.position, dir);
                ////Debug.DrawLine(this.transform.position, GameObject.Find("Player").transform.position);
            }

            if (side == "Connector" & inpExpSide == null)
            {
                inpExpSide = MainBox.GetNearObjects(this.gameObject.transform, true);
                MainBox.UpdateConnObj();
            }

            TEMPSideConnectorCol();

            if (IncomeHeld > MaxLimit)
            {
                IncomeHeld = MaxLimit;
            }
        }
    }