示例#1
0
 protected virtual bool Init(ActDetectorBase instance, string detectorName)
 {
     if (Object.op_Inequality((Object)instance, (Object)null) && Object.op_Inequality((Object)instance, (Object)this) && instance.keepAlive)
     {
         Object.Destroy((Object)this);
         return(false);
     }
     Object.DontDestroyOnLoad((Object)((Component)this).get_gameObject());
     return(true);
 }
示例#2
0
 private static void DestroyDetectorImmediate(ActDetectorBase component)
 {
     if (component.transform.childCount == 0 && component.GetComponentsInChildren <Component>(true).Length <= 2)
     {
         DestroyImmediate(component.gameObject);
     }
     else
     {
         DestroyImmediate(component);
     }
 }
示例#3
0
        protected virtual bool Init(ActDetectorBase instance, string detectorName)
        {
            if (instance != null && instance != this && instance.keepAlive)
            {
                Destroy(this);
                return(false);
            }

            DontDestroyOnLoad(gameObject);
            return(true);
        }
示例#4
0
        protected virtual bool Init(ActDetectorBase instance, string detectorName)
        {
            if (instance != null && instance != this && instance.keepAlive)
            {
                Debug.LogWarning(ACTkConstants.LogPrefix + name +
                                 ": self-destroying, other instance already exists & only one instance allowed!", gameObject);
                Destroy(this);
                return(false);
            }

            DontDestroyOnLoad(gameObject);
            return(true);
        }
示例#5
0
 protected virtual bool Init(ActDetectorBase instance, string detectorName)
 {
     if (instance != null && instance != this && instance.keepAlive)
     {
         if (GameData.gSteam)
         {
             Debug.LogWarning("[ACTk] " + base.name + ": self-destroying, other instance already exists & only one instance allowed!", base.gameObject);
         }
         UnityEngine.Object.Destroy(this);
         return(false);
     }
     UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
     return(true);
 }
示例#6
0
        protected virtual bool Init(ActDetectorBase instance, string detectorName)
        {
            if (instance != null && instance != this && instance.keepAlive)
            {
                Destroy(this);
                return(false);
            }

            /*if (!IsPlacedCorrectly(detectorName))
             * {
             *      Debug.LogWarning("[ACTk] " + detectorName + " is placed in scene incorrectly and will be auto-destroyed!\nPlease, use \"" + MENU_PATH.Replace("/", "->") + detectorName + "\" menu to correct this!");
             *      Destroy(gameObject);
             *      return false;
             * }*/

            DontDestroyOnLoad(gameObject);
            return(true);
        }
示例#7
0
        protected virtual bool Init(ActDetectorBase instance, string detectorName)
        {
            if (instance != null)
            {
                Debug.LogWarning("[ACT] Only one " + detectorName + " instance allowed!");
                Destroy(gameObject);
                return(false);
            }

            if (!IsPlacedCorrectly(detectorName))
            {
                Debug.LogWarning("[ACT] " + detectorName + " is placed in scene incorrectly and will be auto-destroyed!\nPlease, use \"" + MENU_PATH.Replace("/", "->") + detectorName + "\" menu to correct this!");
                Destroy(gameObject);
                return(false);
            }

            DontDestroyOnLoad(gameObject);
            return(true);
        }