Exemple #1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            GUILayout.BeginHorizontal();

            GUILayout.Label("Transitions", GUILayout.MaxWidth(80f));

            DisplayAddTransition("new-t");

            GUILayout.EndHorizontal();

            Dictionary <string, Transition[]> transitionsById =
                TransitionUtils.FindAndGroupTransitions(this.panel.transform);

            foreach (KeyValuePair <string, Transition[]> t in transitionsById)
            {
                DisplayTransitionType(t.Key, t.Value);
            }

            DisplayIfMissing(transitionsById, PanelTransition.IN.name, PanelTransition.OUT.name);

            GUI.contentColor = Color.white;

            if (m_doOrganizeInspector)
            {
                m_doOrganizeInspector = false;
                OrganizeInspector();
            }
        }
Exemple #2
0
    private void DrawTiles()
    {
        material.SetFloat("_BlendMode", 1);
        for (var i = 0; i < material.passCount; ++i)
        {
            material.SetPass(i);
            GL.Begin(GL.QUADS);

            foreach (Tile tile in tiles)
            {
                float   tileProgress = TransitionUtils.SmoothProgress(tile.startTime, tileFallTime, effectTime);
                Vector2 position     = tile.position - Vector2.up * tileProgress; // move the tile down

                if (position.y < 1 && position.y >= (-actualTileSize.y))
                {
                    GL.TexCoord3(tile.column * actualTileSize.x, tile.row * actualTileSize.y, 0);
                    GL.Vertex3(position.x, position.y, 0);
                    GL.TexCoord3(tile.column * actualTileSize.x, (tile.row + 1) * actualTileSize.y, 0);
                    GL.Vertex3(position.x, position.y + actualTileSize.y, 0);
                    GL.TexCoord3((tile.column + 1) * actualTileSize.x, (tile.row + 1) * actualTileSize.y, 0);
                    GL.Vertex3(position.x + actualTileSize.x, position.y + actualTileSize.y, 0);
                    GL.TexCoord3((tile.column + 1) * actualTileSize.x, tile.row * actualTileSize.y, 0);
                    GL.Vertex3(position.x + actualTileSize.x, position.y, 0);
                }
            }
            GL.End();
        }
    }
Exemple #3
0
        private void OnStartGameClicked()
        {
            Contexts.sharedInstance.gameSettings.isSpeedrun = false;

            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToTeardownTransition,
                TransitionComponent = new ControllerToTeardownTransitionComponent
                {
                    Value = GameControllerType.MainMenu
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToRemove,
                TransitionComponent = new SceneToRemoveComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.MainMenuSceneName
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToAdd,
                TransitionComponent = new SceneToAddComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.LevelSelectionSceneName
                }
            }
                );

            GameEntity mainMenuEntity = gameObject.GetEntityLink().entity as GameEntity;

            mainMenuEntity?.DestroyEntity();
        }
Exemple #4
0
        private void OnRestartClicked()
        {
            Contexts.sharedInstance.saveData.DestroyAllEntities();

            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToRestartTransition,
                TransitionComponent = new ControllerToRestartTransitionComponent {
                    Value = GameControllerType.Speedrun
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToRestartTransition,
                TransitionComponent = new ControllerToRestartTransitionComponent {
                    Value = GameControllerType.Game
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.LevelIndexToLoadTransition,
                TransitionComponent = new LevelIndexToLoadTransitionComponent
                {
                    Value = 1
                }
            }
                );

            ((GameEntity)gameObject.GetEntityLink().entity).DestroyEntity();
        }
        private void OnRestartClicked()
        {
            IGroup <GameEntity> levelEntityGroup = Contexts.sharedInstance.game.GetGroup(GameMatcher.Level);

            Contexts.sharedInstance.saveData.isSaveGameTrigger = true;
            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToRestartTransition,
                TransitionComponent = new ControllerToRestartTransitionComponent {
                    Value = GameControllerType.Game
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.LevelIndexToLoadTransition,
                TransitionComponent = new LevelIndexToLoadTransitionComponent
                {
                    Value = levelEntityGroup.GetSingleEntity().levelIndex.Value
                }
            }
                );

            ((GameEntity)gameObject.GetEntityLink().entity).DestroyEntity();
        }
        private void OnNextLevelClicked()
        {
            IGroup <GameEntity> levelEntityGroup = Contexts.sharedInstance.game.GetGroup(GameMatcher.Level);
            int levelCount        = GameConfigurations.AssetReferenceConfiguration.LevelAssetReferences.Length;
            int currentLevelIndex = levelEntityGroup.GetSingleEntity().levelIndex.Value;

            Contexts.sharedInstance.saveData.isSaveGameTrigger = true;
            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToRestartTransition,
                TransitionComponent = new ControllerToRestartTransitionComponent {
                    Value = GameControllerType.Game
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.LevelIndexToLoadTransition,
                TransitionComponent = new LevelIndexToLoadTransitionComponent
                {
                    Value = currentLevelIndex < levelCount - 1 ? currentLevelIndex + 1 : 1
                }
            }
                );
            ((GameEntity)gameObject.GetEntityLink().entity).DestroyEntity();
        }
Exemple #7
0
    public override void OnReady2Do()                         // 准备
    {
        base.OnReady2Do();
        if (material == null)
        {
            material = new Material(Shader.Find("Scene Manager/Tetris Effect"));
            material.SetTexture("_Background", Texture2D.blackTexture);
        }

        duration       = 0;
        columns        = Mathf.FloorToInt(Screen.width / TransitionUtils.ToAbsoluteSize(preferredTileSize.x, Screen.width));
        rows           = Mathf.FloorToInt(Screen.height / TransitionUtils.ToAbsoluteSize(preferredTileSize.y, Screen.height));
        actualTileSize = new Vector2(1f / columns, 1f / rows);

        tiles = new List <Tile>(columns * rows);
        for (int x = 0; x < columns; x++)
        {
            float startTime = 0;
            for (int y = 0; y < rows; y++)
            {
                startTime += UnityEngine.Random.Range(minDelayBetweenTiles, maxDelayBetweenTiles);
                tiles.Add(new Tile(x, y,
                                   new Vector2(x * actualTileSize.x, y * actualTileSize.y + (IsOut ? 0 : 1)),
                                   startTime));
                duration = Mathf.Max(duration, startTime);
            }
        }

        duration += tileFallTime;
    }
Exemple #8
0
    public override void OnReady2Do()
    {
        base.OnReady2Do();
        if (material == null)
        {
            material = new Material(Shader.Find("Scene Manager/Tiles Effect"));
            material.SetTexture("_Backface", Texture2D.blackTexture);
            material.SetTexture("_Background", Texture2D.blackTexture);
        }

        topLeft = Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, distance));

        bottomRight = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, distance));

        width  = bottomRight.x - topLeft.x;
        height = topLeft.y - bottomRight.y;

        columns = Mathf.FloorToInt(Screen.width / TransitionUtils.ToAbsoluteSize(preferredTileSize.x, Screen.width));
        rows    = Mathf.FloorToInt(Screen.height / TransitionUtils.ToAbsoluteSize(preferredTileSize.y, Screen.height));

        // recalculate size to avoid clipped tiles
        actualTileSize = new Vector2(width / columns, height / rows);

        tileStartOffset = (duration - tilesFlipTime) / (columns + rows);
    }
Exemple #9
0
 public bool GetTransitions(string name, out Transition[] tlist)
 {
     if (m_transitionsByName == null)
     {
         m_transitionsByName = TransitionUtils.FindAndGroupTransitions(this.transform);
     }
     return(m_transitionsByName.TryGetValue(name, out tlist));
 }
Exemple #10
0
    public override void OnReady2Do()
    {
        int preferredHeightInPixel = TransitionUtils.ToAbsoluteSize(BlindsHeight, Screen.height);

        numberOfBlinds     = Mathf.FloorToInt(Screen.height / preferredHeightInPixel);
        actualBlindsHeight = (float)Screen.height / (float)numberOfBlinds;
        blindsStartOffset  = (duration - BlindsTime) / (float)numberOfBlinds;
    }
Exemple #11
0
    public override void OnReady2Do()                         // 准备
    {
        base.OnReady2Do();

        duration = fadeOutStartTime + fadeOutDuration;
        float borderSizeInPixel = TransitionUtils.ToAbsoluteSize(borderSize, Screen.height);

        actualBorderSize = borderSizeInPixel / Screen.height;
    }
Exemple #12
0
        public void Should_Return_All_Activities_When_retrieving_of_All_next_Activities_From_Start()
        {
            List <string> expected = new List <string> {
                "step1", "step3", "End", "step2", "End"
            };
            var nextCommonActivity = TransitionUtils.GetAllNextActivities("start", this.complexProcessTransitions);

            Assert.AreEqual(expected, nextCommonActivity);
        }
Exemple #13
0
        public void Should_Return_End_When_retrieving_of_next_common_Activity_After_Start()
        {
            List <string> activitiesAfterStart = new List <string> {
                "step1", "step2"
            };
            var nextCommonActivity = TransitionUtils.GetNextCommonActivity(activitiesAfterStart, this.complexProcessTransitions);

            Assert.AreEqual("End", nextCommonActivity);
        }
Exemple #14
0
        protected override async void Execute(List <GameEntity> entities)
        {
            int levelCount        = GameConfigurations.AssetReferenceConfiguration.LevelAssetReferences.Length;
            int currentLevelIndex = _levelEntityGroup.GetSingleEntity().levelIndex.Value;

            if (Contexts.sharedInstance.game.isAllCollectedInLevel)
            {
                if (currentLevelIndex >= levelCount - 1)
                {
                    GameContext gameContext = Contexts.sharedInstance.game;
                    GameEntity  finishSpeedrunDialogEntity = gameContext.CreateEntity();
                    await AssetLoaderUtils.InstantiateAssetAsyncTask(GameConfigurations.AssetReferenceConfiguration.FinishSpeedrunDialogReference, finishSpeedrunDialogEntity, gameContext.staticLayer.Value.transform);

                    finishSpeedrunDialogEntity.isFinishSpeedrunDialog = true;
                }
                else
                {
                    TransitionUtils.StartTransitionSequence(
                        new TransitionComponentData
                    {
                        Index = GameComponentsLookup.ControllerToRestartTransition,
                        TransitionComponent = new ControllerToRestartTransitionComponent {
                            Value = GameControllerType.Game
                        }
                    },
                        new TransitionComponentData
                    {
                        Index = GameComponentsLookup.LevelIndexToLoadTransition,
                        TransitionComponent = new LevelIndexToLoadTransitionComponent
                        {
                            Value = currentLevelIndex < levelCount - 1 ? currentLevelIndex + 1 : 1
                        }
                    }
                        );
                }
            }
            else
            {
                TransitionUtils.StartTransitionSequence(
                    new TransitionComponentData
                {
                    Index = GameComponentsLookup.ControllerToRestartTransition,
                    TransitionComponent = new ControllerToRestartTransitionComponent {
                        Value = GameControllerType.Game
                    }
                },
                    new TransitionComponentData
                {
                    Index = GameComponentsLookup.LevelIndexToLoadTransition,
                    TransitionComponent = new LevelIndexToLoadTransitionComponent
                    {
                        Value = currentLevelIndex
                    }
                }
                    );
            }
        }
Exemple #15
0
    public override bool OnProcessAnim(float elapsedTime)
    {
        float effectTime = elapsedTime;

        if (IsOut == false)
        {
            effectTime = duration - effectTime;
        }

        progress = TransitionUtils.SmoothProgress(0, duration, effectTime);

        return(elapsedTime < duration);
    }
Exemple #16
0
    public override bool OnProcessAnim(float elapsedTime)           // While 控制动画播放时间
    {
        float effectTime = elapsedTime;

        if (!IsOut)
        {
            effectTime = duration - effectTime;
        }

        pixelateProgress = TransitionUtils.SmoothProgress(StartOffset, Duration, effectTime);
        fadeProgress     = TransitionUtils.SmoothProgress(fadeStartOffset, fadeDuration, effectTime);

        return(elapsedTime < duration);
    }
Exemple #17
0
    void OnGUI()
    {
        GUI.depth = 0;
        Color firstColor = GUI.color;

        GUI.color = Color.black;
        for (int i = 0; i < numberOfBlinds; i++)
        {
            float progress      = TransitionUtils.SmoothProgress(i * blindsStartOffset, BlindsTime, effectTime);
            float visibleHeight = actualBlindsHeight * progress;
            GUI.DrawTexture(new Rect(0, i * actualBlindsHeight + (actualBlindsHeight - visibleHeight) / 2f, Screen.width, visibleHeight), Texture2D.whiteTexture);
        }
        GUI.color = firstColor;
    }
Exemple #18
0
 public void updateColour(float transitionTime)
 {
     if (this.activeSprite != null)
     {
         if (StateManager.getInstance().CurrentTransitionState == StateManager.TransitionState.TransitionIn)
         {
             this.activeSprite.LightColour = TransitionUtils.fadeIn(Color.White, Display.TRANSITION_TIME, transitionTime);
         }
         else if (StateManager.getInstance().CurrentTransitionState == StateManager.TransitionState.TransitionOut)
         {
             this.activeSprite.LightColour = TransitionUtils.fadeOut(Color.White, Display.TRANSITION_TIME, transitionTime);
         }
     }
 }
Exemple #19
0
    private void DrawBlade(float time)
    {
        float cutProgress = TransitionUtils.Progress(0, cutDuration, time);

        if (cutProgress > 0 && cutProgress < 1)
        {
            DrawBlade(firstCutStart, firstCutEnd, cutProgress, false);
        }

        cutProgress = TransitionUtils.Progress(cutDuration + delayBetweenCuts, cutDuration, time);
        if (cutProgress > 0 && cutProgress < 1)
        {
            DrawBlade(secondCutEnd, secondCutStart, 1 - cutProgress, true);
        }
    }
Exemple #20
0
 public void updateColour(float transitionTime)
 {
     if (StateManager.getInstance().CurrentTransitionState == StateManager.TransitionState.TransitionIn)
     {
         this.Text.LightColour            = TransitionUtils.fadeIn(ResourceManager.getInstance().TextColour, Display.TRANSITION_TIME, transitionTime);
         this.myTurnSprite.LightColour    = TransitionUtils.fadeIn(Color.White, Display.TRANSITION_TIME, transitionTime);
         this.notMyTurnSprite.LightColour = TransitionUtils.fadeIn(Color.White, Display.TRANSITION_TIME, transitionTime);
     }
     else if (StateManager.getInstance().CurrentTransitionState == StateManager.TransitionState.TransitionOut)
     {
         this.Text.LightColour            = TransitionUtils.fadeOut(ResourceManager.getInstance().TextColour, Display.TRANSITION_TIME, transitionTime);
         this.myTurnSprite.LightColour    = TransitionUtils.fadeOut(Color.White, Display.TRANSITION_TIME, transitionTime);
         this.notMyTurnSprite.LightColour = TransitionUtils.fadeOut(Color.White, Display.TRANSITION_TIME, transitionTime);
     }
 }
Exemple #21
0
    public override bool OnProcessAnim(float elapsedTime)           // 动画进度
    {
        float effectTime = elapsedTime;

        // invert direction
        if (!IsOut)                                      // 如果是进入新场景了
        {
            effectTime = duration - effectTime;
        }

        borderProgress = TransitionUtils.SmoothProgress(borderStartTime, borderDuration, effectTime);
        tintProgress   = TransitionUtils.SmoothProgress(tintStartTime, tintDuration, effectTime);
        fadeProgress   = TransitionUtils.SmoothProgress(fadeOutStartTime, fadeOutDuration, effectTime);

        return(elapsedTime < duration);
    }
Exemple #22
0
    private void DrawPieces(float time)
    {
        material.SetFloat("_BlendMode", IsOut ? 1 : 0);

        for (var i = 0; i < material.passCount; ++i)
        {
            material.SetPass(i);
            GL.Begin(GL.QUADS);

            Vector3 progress = new Vector3(0,
                                           -Screen.height * TransitionUtils.SmoothProgress(cutDuration, pieceFallTime, time), 0);
            GL.TexCoord3(0, 0, 0);
            GL.Vertex3(0, progress.y, 0);
            GL.TexCoord3(0, .2f, 0);
            GL.Vertex(firstCutStart + progress);
            GL.TexCoord3(1, .4f, 0);
            GL.Vertex(firstCutEnd + progress);
            GL.TexCoord3(1, 0, 0);
            GL.Vertex3(Screen.width, progress.y, 0);

            progress = new Vector3(0,
                                   -Screen.height *
                                   TransitionUtils.SmoothProgress(2 * cutDuration + delayBetweenCuts, pieceFallTime, time), 0);
            GL.TexCoord3(0, .2f, 0);
            GL.Vertex(firstCutStart + progress);
            GL.TexCoord3(0, .9f, 0);
            GL.Vertex(secondCutEnd + progress);
            GL.TexCoord3(1, .6f, 0);
            GL.Vertex(secondCutStart + progress);
            GL.TexCoord3(1, .4f, 0);
            GL.Vertex(firstCutEnd + progress);

            progress = new Vector3(0,
                                   -Screen.height *
                                   TransitionUtils.SmoothProgress(2 * cutDuration + 2 * delayBetweenCuts, pieceFallTime, time), 0);
            GL.TexCoord3(0, .9f, 0);
            GL.Vertex(secondCutEnd + progress);
            GL.TexCoord3(0, 1, 0);
            GL.Vertex3(0, Screen.height + progress.y, 0);
            GL.TexCoord3(1, 1, 0);
            GL.Vertex3(Screen.width, Screen.height + progress.y, 0);
            GL.TexCoord3(1, .6f, 0);
            GL.Vertex(secondCutStart + progress);

            GL.End();
        }
    }
Exemple #23
0
        public void UpdateTransforms(float scale)
        {
            if (Time.time - m_SetupTime > k_InitializeDelay)
            {
                m_SetupTime = float.MaxValue;

                // If this AssetData hasn't started fetching its asset yet, do so now
                if (!data.initialized)
                {
                    data.Initialize();
                }

#if INCLUDE_POLY_TOOLKIT
                data.modelImportCompleted     += OnModelImportCompleted;
                data.thumbnailImportCompleted += OnThumbnailImportCompleted;
#endif
            }

            // Don't scale the item while changing visibility because this would conflict with AnimateVisibility
            if (m_VisibilityCoroutine != null)
            {
                return;
            }

            var time = Time.time;

            TransitionUtils.AnimateProperty(time, m_Hovered, ref m_WasHovered, ref m_HoverTime, ref m_HoverLerp,
                                            ref m_HoverLerpStart, 0f, 1f, k_PreviewDuration, Mathf.Approximately, TransitionUtils.GetPercentage,
                                            Mathf.Lerp, m_SetThumbnailScale, true, m_CompleteHoverTransition);

            TransitionUtils.AnimateProperty(time, m_Importing, ref m_WasImporting, ref m_ImportingTime,
                                            ref m_ImportingScale, ref m_ImportingStartScale, m_IconScale.y, k_ImportingScaleBump, k_PreviewDuration,
                                            Mathf.Approximately, TransitionUtils.GetPercentage, Mathf.Lerp, m_SetImportingScale, false);

            TransitionUtils.AnimateProperty(time, m_Importing, ref m_WasImporting, ref m_ImportingTime,
                                            ref m_ImportingColor, ref m_ImportingStartColor, m_ImportingDefaultColor, m_ImportingTargetColor,
                                            k_PreviewDuration, TransitionUtils.Approximately, TransitionUtils.GetPercentage, Color.Lerp,
                                            m_SetImportingColor);

            scaleFactor = scale;

            transform.localScale = Vector3.one * scale;

            m_TextPanel.transform.localRotation = CameraUtils.LocalRotateTowardCamera(transform.parent);
        }
Exemple #24
0
        private void OnStartGameButtonClicked()
        {
            Contexts.sharedInstance.gameSettings.isSpeedrun = true;
            Contexts.sharedInstance.saveData.DestroyAllEntities();

            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToTeardownTransition,
                TransitionComponent = new ControllerToTeardownTransitionComponent
                {
                    Value = GameControllerType.MainMenu
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToRemove,
                TransitionComponent = new SceneToRemoveComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.MainMenuSceneName
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToAdd,
                TransitionComponent = new SceneToAddComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.GameSceneName,
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.LevelIndexToLoadTransition,
                TransitionComponent = new LevelIndexToLoadTransitionComponent {
                    Value = 1
                }
            }
                );

            GameEntity mainMenuEntity = gameObject.GetEntityLink().entity as GameEntity;

            gameObject.Unlink();
            mainMenuEntity?.Destroy();
            Destroy(gameObject);
        }
Exemple #25
0
    protected override void OnLastRenderer2Do()
    {
        base.OnLastRenderer2Do();
        GL.PushMatrix();
        DrawBackground();
        GL.Clear(true, false, Color.black);

        for (int x = 0; x < columns; x++)
        {
            for (int y = 0; y < rows; y++)
            {
                float tileProgress = TransitionUtils.SmoothProgress((x + y) * tileStartOffset, tilesFlipTime, effectTime);
                DrawTile(x, y, tileProgress * 180);
            }
        }

        GL.PopMatrix();
    }
Exemple #26
0
        public override async UniTask ExecuteAsync(CancellationToken cancellationToken = default)
        {
            var easingType = EasingType.Linear;

            if (Assigned(EasingTypeName) && !Enum.TryParse(EasingTypeName, true, out easingType))
            {
                LogWarningWithPosition($"Failed to parse `{EasingTypeName}` easing.");
            }

            var transitionName = TransitionType.Crossfade;

            if (Assigned(Transition))
            {
                transitionName = Transition.Value;
            }
            var defaultParams    = TransitionUtils.GetDefaultParams(transitionName);
            var transitionParams = Assigned(TransitionParams) ? new Vector4(
                TransitionParams.ElementAtOrNull(0) ?? defaultParams.x,
                TransitionParams.ElementAtOrNull(1) ?? defaultParams.y,
                TransitionParams.ElementAtOrNull(2) ?? defaultParams.z,
                TransitionParams.ElementAtOrNull(3) ?? defaultParams.w) : defaultParams;

            if (Assigned(DissolveTexturePath) && !ObjectUtils.IsValid(preloadedDissolveTexture))
            {
                preloadedDissolveTexture = Resources.Load <Texture2D>(DissolveTexturePath);
            }

            var transition   = new Transition(transitionName, transitionParams, preloadedDissolveTexture);
            var transitionUI = Engine.GetService <IUIManager>().GetUI <UI.ISceneTransitionUI>();

            if (transitionUI != null)
            {
                await transitionUI.TransitionAsync(transition, Duration, easingType, cancellationToken);
            }
            else
            {
                LogErrorWithPosition($"Failed to finish scene transition: `{nameof(UI.ISceneTransitionUI)}` UI is not available.");
            }
        }
Exemple #27
0
    public override void OnReady2Do()
    {
        base.OnReady2Do();
        if (material == null)
        {
            material = new Material(Shader.Find("Scene Manager/Cartoon Effect"));
            material.SetTexture("_Background", Texture2D.blackTexture);
        }

        Vector2 pixelCenter = new Vector2(TransitionUtils.ToAbsoluteSize(center.x, Screen.width), TransitionUtils.ToAbsoluteSize(center.y, Screen.height));

        Vector2 bottomLeftPath  = pixelCenter - new Vector2(0, 0);
        Vector2 topLeftPath     = pixelCenter - new Vector2(0, Screen.height);
        Vector2 topRightPath    = pixelCenter - new Vector2(Screen.width, Screen.height);
        Vector2 bottomRightPath = pixelCenter - new Vector2(Screen.width, 0);

        length = Mathf.Max(bottomLeftPath.magnitude, topLeftPath.magnitude, topRightPath.magnitude, bottomRightPath.magnitude);
        material.SetFloat("_CenterX", pixelCenter.x);
        material.SetFloat("_CenterY", pixelCenter.y);

        material.SetColor("_BorderColor", borderColor);
    }
Exemple #28
0
        protected virtual async UniTask ApplyAppearanceModificationAsync(TActor actor, EasingType easingType, float duration, CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(AssignedAppearance))
            {
                return;
            }

            var transitionName   = !string.IsNullOrEmpty(AssignedTransition) ? AssignedTransition : TransitionType.Crossfade;
            var defaultParams    = TransitionUtils.GetDefaultParams(transitionName);
            var transitionParams = Assigned(TransitionParams) ? new Vector4(
                TransitionParams.ElementAtOrNull(0) ?? defaultParams.x,
                TransitionParams.ElementAtOrNull(1) ?? defaultParams.y,
                TransitionParams.ElementAtOrNull(2) ?? defaultParams.z,
                TransitionParams.ElementAtOrNull(3) ?? defaultParams.w) : defaultParams;

            if (Assigned(DissolveTexturePath) && !ObjectUtils.IsValid(preloadedDissolveTexture))
            {
                preloadedDissolveTexture = Resources.Load <Texture2D>(DissolveTexturePath);
            }
            var transition = new Transition(transitionName, transitionParams, preloadedDissolveTexture);

            await actor.ChangeAppearanceAsync(AssignedAppearance, duration, easingType, transition, cancellationToken);
        }
Exemple #29
0
        private void OnMainMenuClicked()
        {
            Contexts.sharedInstance.saveData.isSaveGameTrigger = true;
            Contexts.sharedInstance.gameSettings.isSpeedrun    = false;
            TransitionUtils.StartTransitionSequence(
                new TransitionComponentData
            {
                Index = GameComponentsLookup.ControllerToTeardownTransition,
                TransitionComponent = new ControllerToTeardownTransitionComponent
                {
                    Value = GameControllerType.Game
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToRemove,
                TransitionComponent = new SceneToRemoveComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.GameSceneName
                }
            },
                new TransitionComponentData
            {
                Index = GameComponentsLookup.SceneToAdd,
                TransitionComponent = new SceneToAddComponent
                {
                    Value = GameConfigurations.GameSceneConfiguration.MainMenuSceneName
                }
            }
                );

            GameEntity dialogEntity = gameObject.GetEntityLink().entity as GameEntity;

            gameObject.Unlink();
            dialogEntity?.Destroy();
            Destroy(gameObject);
        }
 protected override void Execute(List <GameEntity> entities)
 {
     TransitionUtils.StartTransitionSequence(
         new TransitionComponentData
     {
         Index = GameComponentsLookup.ControllerToTeardownTransition,
         TransitionComponent = new ControllerToTeardownTransitionComponent
         {
             Value = GameControllerType.LevelSelection
         }
     },
         new TransitionComponentData
     {
         Index = GameComponentsLookup.SceneToRemove,
         TransitionComponent = new SceneToRemoveComponent
         {
             Value = GameConfigurations.GameSceneConfiguration.LevelSelectionSceneName
         }
     },
         new TransitionComponentData
     {
         Index = GameComponentsLookup.SceneToAdd,
         TransitionComponent = new SceneToAddComponent
         {
             Value = GameConfigurations.GameSceneConfiguration.GameSceneName,
         }
     },
         new TransitionComponentData
     {
         Index = GameComponentsLookup.LevelIndexToLoadTransition,
         TransitionComponent = new LevelIndexToLoadTransitionComponent {
             Value = entities[0].levelSelected.Value
         }
     }
         );
 }