Exemplo n.º 1
0
        private void StartFade(SceneDescription newScene, Fade fadeIn, Fade fadeOut, float delay = 0)
        {
            if (this.IsFading)
            {
                FlaiDebug.LogWarningWithTypeTag <SceneFader>("Can't start a new fade. There is already another fade in progress", this);
                return;
            }
            else if (this.IsFadeDelayRunning)
            {
                FlaiDebug.LogWarningWithTypeTag <SceneFader>("Can't start a new fade. There is already another fade pending (delay: " + _fadeDelay.Value + "}", this);
                return;
            }

            Ensure.NotNull(fadeIn, "'fadeIn' cannot be null. Use Fade.None instead");
            Ensure.NotNull(fadeOut, "'fadeOut' cannot be null. Use Fade.None instead");

            _fadeIn    = fadeIn;
            _fadeOut   = fadeOut;
            _newScene  = newScene;
            _fadeDelay = (delay == 0) ? default(float?) : delay;

            if (!_fadeDelay.HasValue)
            {
                this.BeginFading();
            }
        }
Exemplo n.º 2
0
        protected override void Awake()
        {
            var renderer = this.renderer;

            if (renderer == null)
            {
                FlaiDebug.LogWarningWithTypeTag <SortingOrderSetter>("Renderer is null");
            }
            else
            {
                renderer.sortingOrder = this.SortingOrder;
            }
        }
Exemplo n.º 3
0
        private void DrawMethod(MethodInfo method, ShowInInspectorAttribute attribute)
        {
            if (method.ContainsGenericParameters || method.GetParameters().Length > 0)
            {
                FlaiDebug.LogWarningWithTypeTag <DefaultInspector>("Method '{0}' has parameters or generic parameters. It cannot be called", method.Name);
                return;
            }

            FlaiGUI.PushGuiEnabled(!attribute.IsReadOnly && (attribute.IsEditableWhenNotPlaying || Application.isPlaying));
            if (GUILayout.Button(this.GetName(method.Name, attribute)))
            {
                method.Invoke(this.Target, null);
            }
            FlaiGUI.PopGuiEnabled();
        }
Exemplo n.º 4
0
        private Texture2D LoadTexture(string tileset)
        {
            tileset = tileset.Trim();
            Texture2D texture;

            if (!_tilesetTextures.TryGetValue(tileset, out texture) || texture == null)
            {
                texture = Resources.Load <Texture2D>(tileset);
                _tilesetTextures.AddOrSetValue(tileset, texture);
                if (texture == null)
                {
                    FlaiDebug.LogWarningWithTypeTag <TilemapSpriteManager>("Couldn't find tileset texture {0}", tileset);
                }
            }

            return(texture);
        }