Пример #1
0
 public static UnityEngine.GameObject InstantiateAtPosWithAutodestroy(UnityEngine.GameObject effectTemplate, Vector3 toPos)
 {
     UnityEngine.GameObject effect = InstantiateWithAutodestroy(effectTemplate);
     effect.transform.position = toPos;
     Finder.FindComponentAddIfNotExist <Duration>(effect);
     return(effect);
 }
Пример #2
0
        /// <summary>
        /// Links to toObj.
        /// </summary>
        /// <param name="destroyWithParent">If parent is destroyed and set to <c>false</c> it will unlinks and stay on last position.</param>
        public static void LinkTo(UnityEngine.GameObject obj, UnityEngine.GameObject toObj, bool inheritRotation = true, bool inheritSorting = true, bool destroyWithParent = false)
        {
            if (obj == null)
            {
                return;
            }

            Finder.FindComponentAddIfNotExist <TopInfo>(obj);

            if (toObj == null)
            {
                TopInfo topInfo = TopInfo.GameObjectTop(obj, 2).GameObjectTopInfo <TopInfo>();

                obj.transform.parent = Sys.ResourceManager.Instance.RuntimeParent();
                if (topInfo)
                {
                    topInfo.UnlinkOnDestroyRemove(obj);
                }
            }
            else
            {
                if (!destroyWithParent)
                {
                    TopInfo topInfo = toObj.GameObjectTopInfo <TopInfo>();

                    if (topInfo)
                    {
                        topInfo.UnlinkOnDestroyAdd(obj);
                    }
                }

                obj.transform.position = toObj.transform.position;
                if (inheritRotation)
                {
                    obj.transform.rotation = toObj.transform.rotation;
                }
                obj.transform.parent = toObj.transform;
                if (inheritSorting)
                {
                    Finder.FindComponentAddIfNotExist <SortingLayer>(obj).SortAllDeepFromParent();
                }
            }
        }
Пример #3
0
 public static UnityEngine.GameObject InstantiateWithAutodestroy(UnityEngine.GameObject effectTemplate)
 {
     UnityEngine.GameObject effect = InstantiateAndLink(effectTemplate, null, "", false, false);
     Finder.FindComponentAddIfNotExist <Duration>(effect);
     return(effect);
 }
Пример #4
0
 public static UnityEngine.GameObject InstantiateAndLinkWithAutodestroy(UnityEngine.GameObject effectTemplate, UnityEngine.GameObject toObjPos, string preferedChildName)
 {
     UnityEngine.GameObject effect = InstantiateAndLink(effectTemplate, toObjPos, preferedChildName, false, false);
     Finder.FindComponentAddIfNotExist <Duration>(effect);
     return(effect);
 }
Пример #5
0
 public static UnityEngine.GameObject InstantiateAndLinkWithAutodestroy(UnityEngine.GameObject effectTemplate, UnityEngine.GameObject toObjPos, bool inheritSorting)
 {
     UnityEngine.GameObject effect = InstantiateAndLink(effectTemplate, toObjPos, null, false, inheritSorting);
     Finder.FindComponentAddIfNotExist <Duration>(effect);
     return(effect);
 }
Пример #6
0
 public static UnityEngine.GameObject InstantiateAtPosWithAutodestroy(UnityEngine.GameObject effectTemplate, UnityEngine.GameObject toObjPos, float time)
 {
     UnityEngine.GameObject effect = InstantiateAndLink(effectTemplate, toObjPos, null, true, false);
     Finder.FindComponentAddIfNotExist <Duration>(effect).SetDuration(time);
     return(effect);
 }
Пример #7
0
 public static UnityEngine.GameObject InstantiateAtPosWithAutodestroy(UnityEngine.GameObject effectTemplate, UnityEngine.GameObject toObjPos)
 {
     UnityEngine.GameObject effect = InstantiateAtPosWithAutodestroy(effectTemplate, toObjPos, -1);
     Finder.FindComponentAddIfNotExist <Duration>(effect);
     return(effect);
 }