// --- Public/Internal Methods ------------------------------------------------------------------------------------
    public override void ReturnToFactory()
    {
        Debug.Log($"{this.GetType().Name} returning to factory!");
        foreach (Rigidbody rb in GetComponentsInChildren<Rigidbody>())
        {
            if (rb.gameObject == this.gameObject)
                continue;
            rb.isKinematic = true;
        }
        MonoFactory.ReturnFactoryObject(this);

        //for (int i = 0; i < _prefab.transform.childCount; i++)
        //{
        //    for (int j = 0; j < _prefab.transform.GetChild(i).childCount; j++)
        //    {
        //        for (int k = 0; k < _prefab.transform.GetChild(i).GetChild(j).childCount; k++)
        //        {
        //            transform.GetChild(i).GetChild(j).GetChild(k).localRotation = _prefab.transform.GetChild(i).GetChild(j).GetChild(k).localRotation;
        //            transform.GetChild(i).GetChild(j).GetChild(k).localPosition = _prefab.transform.GetChild(i).GetChild(j).GetChild(k).localPosition;
        //        }

        //    }
        //}

        BoxCollider[] prefabCols =_prefab.GetComponentsInChildren<BoxCollider>(true);
        BoxCollider[] thisCols = transform.GetComponentsInChildren<BoxCollider>(true);
        for (int i = 0; i < prefabCols.Length; i++)
        {
            thisCols[i].transform.localPosition = prefabCols[i].transform.localPosition;
            thisCols[i].transform.localRotation = prefabCols[i].transform.localRotation;
        }
    }
Example #2
0
 virtual public void ReturnToFactory()
 {
     if (Player != null)
     {
         Player.ClearBullet();
         Player = null;
     }
     MonoFactory.ReturnFactoryObject(this);
 }
Example #3
0
 public virtual void ReturnToFactory()
 {
     Debug.Log($"{this.GetType().Name} returning to factory!");
     MonoFactory.ReturnFactoryObject(this);
 }