Beispiel #1
0
        public ParticleType(ParticleType copyFrom)
        {
            Source             = copyFrom.Source;
            SourceChooser      = copyFrom.SourceChooser;
            Color              = copyFrom.Color;
            Color2             = copyFrom.Color2;
            ColorMode          = copyFrom.ColorMode;
            FadeMode           = copyFrom.FadeMode;
            SpeedMin           = copyFrom.SpeedMin;
            SpeedMax           = copyFrom.SpeedMax;
            SpeedMultiplier    = copyFrom.SpeedMultiplier;
            Acceleration       = copyFrom.Acceleration;
            Friction           = copyFrom.Friction;
            Direction          = copyFrom.Direction;
            DirectionRange     = copyFrom.DirectionRange;
            LifeMin            = copyFrom.LifeMin;
            LifeMax            = copyFrom.LifeMax;
            Size               = copyFrom.Size;
            SizeRange          = copyFrom.SizeRange;
            RotationMode       = copyFrom.RotationMode;
            SpinMin            = copyFrom.SpinMin;
            SpinMax            = copyFrom.SpinMax;
            SpinFlippedChance  = copyFrom.SpinFlippedChance;
            ScaleOut           = copyFrom.ScaleOut;
            UseActualDeltaTime = copyFrom.UseActualDeltaTime;

            AllTypes.Add(this);
        }
Beispiel #2
0
        public ParticleType()
        {
            Color             = Color2 = Color.White;
            ColorMode         = ColorModes.Static;
            FadeMode          = FadeModes.None;
            SpeedMin          = SpeedMax = 0;
            SpeedMultiplier   = 1;
            Acceleration      = Vector2.Zero;
            Friction          = 0f;
            Direction         = DirectionRange = 0;
            LifeMin           = LifeMax = 0;
            Size              = 2;
            SizeRange         = 0;
            SpinMin           = SpinMax = 0;
            SpinFlippedChance = false;
            RotationMode      = RotationModes.None;

            AllTypes.Add(this);
        }
        /// <summary>
        /// Call this static method to load a scene from anywhere
        /// </summary>
        /// <param name="sceneToLoadName">Level name.</param>
        public static void LoadScene(string sceneToLoadName, string loadingSceneName = "MMAdditiveLoadingScreen",
                                     ThreadPriority threadPriority = ThreadPriority.High, bool secureLoad = true,
                                     bool interpolateProgress      = true,
                                     float beforeEntryFadeDelay    = 0f,
                                     float entryFadeDuration       = 0.25f,
                                     float afterEntryFadeDelay     = 0.1f,
                                     float beforeExitFadeDelay     = 0.25f,
                                     float exitFadeDuration        = 0.2f,
                                     MMTweenType entryFadeTween    = null, MMTweenType exitFadeTween = null,
                                     float progressBarSpeed        = 5f,
                                     FadeModes fadeMode            = FadeModes.FadeInThenOut,
                                     MMAdditiveSceneLoadingManagerSettings.UnloadMethods unloadMethod = MMAdditiveSceneLoadingManagerSettings.UnloadMethods.AllScenes)
        {
            if (_loadingInProgress)
            {
                Debug.LogError("MMLoadingSceneManagerAdditive : a request to load a new scene was emitted while a scene load was already in progress");
                return;
            }

            if (entryFadeTween == null)
            {
                entryFadeTween = new MMTweenType(MMTween.MMTweenCurve.EaseInOutCubic);
            }

            if (exitFadeTween == null)
            {
                exitFadeTween = new MMTweenType(MMTween.MMTweenCurve.EaseInOutCubic);
            }

            if (secureLoad)
            {
                _scenesInBuild = MMScene.GetScenesInBuild();

                if (!_scenesInBuild.Contains(sceneToLoadName))
                {
                    Debug.LogError("MMLoadingSceneManagerAdditive : impossible to load the '" + sceneToLoadName + "' scene, " +
                                   "there is no such scene in the project's build settings.");
                    return;
                }
                if (!_scenesInBuild.Contains(loadingSceneName))
                {
                    Debug.LogError("MMLoadingSceneManagerAdditive : impossible to load the '" + loadingSceneName + "' scene, " +
                                   "there is no such scene in the project's build settings.");
                    return;
                }
            }

            _loadingInProgress = true;
            _initialScenes     = GetScenesToUnload(unloadMethod);

            Application.backgroundLoadingPriority = threadPriority;
            _sceneToLoadName            = sceneToLoadName;
            _loadingScreenSceneName     = loadingSceneName;
            _beforeEntryFadeDelay       = beforeEntryFadeDelay;
            _entryFadeDuration          = entryFadeDuration;
            _entryFadeTween             = entryFadeTween;
            _afterEntryFadeDelay        = afterEntryFadeDelay;
            _progressInterpolationSpeed = progressBarSpeed;
            _beforeExitFadeDelay        = beforeExitFadeDelay;
            _exitFadeDuration           = exitFadeDuration;
            _exitFadeTween       = exitFadeTween;
            _fadeMode            = fadeMode;
            _interpolateProgress = interpolateProgress;

            SceneManager.LoadScene(_loadingScreenSceneName, LoadSceneMode.Additive);
        }