Example #1
0
 protected override void Start()
 {
     if (alignTo == null)
     {
         return;
     }
     alignable          = FizzleScene.FindObject <IAlignable>(alignTo);
     transform.position = alignable.AlignTransform.position + alignable.AlignHeight * alignable.AlignTransform.up;
 }
Example #2
0
 internal FizzleObject(string name, Type type)
 {
     this.name = name;
     if ((__item = FizzleScene.FindObject(type, name) as FizzleBehaviour) == null)
     {
         throwException();
     }
     if (__check_item == null)
     {
         throwException();
     }
     __item_wrapper  = __item?.GetComponentInParent <ItemWrapper>();
     __mesh_renderer = __item_wrapper?.GetComponentsInChildren <MeshRenderer>();
 }
        public SwitchResponse(string exp)
        {
            if (exp == null)
            {
                return;
            }

            this.exp = new BooleanExpression(exp);
            switches = new Dictionary <string, ISwitch>();
            foreach (string variable in this.exp.GetVariables())
            {
                if (FizzleScene.FindObject <ISwitch>(variable) != null)
                {
                    switches[variable] = FizzleScene.FindObject <ISwitch>(variable);
                }
            }
        }
Example #4
0
        public static IEnumerable <T> get_objects_by_type <T>() where T : FizzleObject
        {
            IEnumerable <ItemWrapper> allItems = FizzleScene.GetAllItems();

            if (typeof(T).IsAbstract)
            {
                yield break;
            }
            foreach (ItemWrapper itemWrapper in allItems)
            {
                ConstructorInfo constructor = typeof(T).GetConstructor(new[] { typeof(string) });
                T obj;
                try
                {
                    obj = constructor == null ? null : constructor.Invoke(new object[] { itemWrapper.name }) as T;
                }
                catch (Exception)
                {
                    continue;
                }

                yield return(obj);
            }
        }
Example #5
0
 public static void run_async(IEnumerator coroutine)
 {
     FizzleScene.StartOneCoroutine(coroutine);
 }