Destroy() публичный Метод

public Destroy ( ) : void
Результат void
Пример #1
0
 public virtual void ClearAll()
 {
     for (int i = 0; i < objectList.Count; i++)
     {
         BaseObject.Destroy(objectList[i]);
         objectList[i] = null;
     }
     objectList.Clear();
 }
Пример #2
0
 public void Put(BaseObject obj)
 {
     if (m_Index == m_Objs.Length - 1)
     {
         obj.Destroy();
         return;
     }
     m_Index++;
     m_Objs[m_Index] = obj;
 }
Пример #3
0
    /// <summary>
    /// 释放对象
    /// </summary>
    private void ReleaseObject(BaseObject pObj)
    {
        if (pObj == null)
        {
            return;
        }

        DetachObject(pObj);
        pObj.Destroy();
        if (pObj.gameObject != null)
        {
            GameObject.Destroy(pObj.gameObject);
        }
    }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        if (!isStuned)
        {
            direction.x = Input.GetAxis("Horizontal");
            direction.z = Input.GetAxis("Vertical");
        }
        else
        {
            direction.x = 0f;
            direction.y = 0f;
        }

        if (Input.GetKeyDown(KeyCode.K))
        {
            //debug
            //int i = 0;
            //foreach (bool b in BaseObject.itemsWellPlacedandRepared)
            //{
            //    Debug.Log(i + " : " + b.ToString());
            //    i++;
            //}
        }


        //a pour poser
        //x pour reparer
        //gachettes pour tourner un objet

        Camera.main.transform.position = gameObject.transform.position + new Vector3(0, 10, -10);

        if (Input.GetButtonDown("Repare") && closestObject != null)
        {
            //kick.Play();
            anim.SetBool("isReparing", true);
            StartCoroutine(WaitAnim());
            closestObject.Repare();
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            Debug.Log("blub");
            closestObject.Destroy();
        }

        if (Input.GetButtonDown("RotateD"))
        {
            pop.Play();
            if (pickedUpObject == null && closestObject != null)
            {
                closestObject.Rotate(45);
            }
            Debug.Log("droite");
        }

        if (Input.GetButtonDown("RotateG"))
        {
            pop.Play();
            if (pickedUpObject == null && closestObject != null)
            {
                closestObject.Rotate(-45);
            }
            Debug.Log("gauche");
        }


        if (Input.GetButtonDown("Poser"))
        {
            if (closestObject != null)
            {
                PickUp();
            }
        }

        pos = gameObject.transform.position;
        if (closeObjects.Count > 0)
        {
            foreach (BaseObject go in closeObjects)
            {
                float dist = (go.transform.position - pos).sqrMagnitude;
                if (dist < minDistObject)
                {
                    minDistObject = dist;
                    closestObject = go;
                }
            }
            minDistObject = 3000;
        }
    }