コード例 #1
0
 static FadeInState()
 {
     self = new FadeInState();
 }
コード例 #2
0
        public override void Update(GameTime gameTime)
        {
            FadeManager.SetFadeColor(Vector4.Zero);
            int PreviousBase = (int)NodesProgress;

            NodesProgress += gameTime.ElapsedGameTime.Milliseconds * ProgressSpeed * 60 / 1000;

            if ((int)NodesProgress > PreviousBase)
            {
                CurrentCenter++;
                while (!SortedCenters.ContainsKey(CurrentCenter))
                {
                    CurrentCenter++;
                    if (CurrentCenter > CenterCount)
                    {
                        CurrentCenter = 0;
                        if (CenterCount == -1)
                        {
                            return;
                        }
                    }
                }

                LastNode       = GetNode((int)NodesProgress);
                NodesProgress += 1;

                while (LastNode == null && NodesProgress <= NodeCount)
                {
                    LastNode       = GetNode((int)NodesProgress);
                    NodesProgress += 1;
                }

                NextNode = GetNode((int)NodesProgress);

                while (NextNode == null && NodesProgress <= NodeCount)
                {
                    NextNode       = GetNode((int)NodesProgress);
                    NodesProgress += 1;
                }
            }

            if (NextNode != null && LastNode != null)
            {
                Vector3 LastPosition   = new Vector3(LastNode.Position.X(), LastNode.Z.get(), LastNode.Position.Y());
                Vector3 NextPosition   = new Vector3(NextNode.Position.X(), NextNode.Z.get(), NextNode.Position.Y());
                Vector3 CenterPosition = new Vector3(SortedCenters[CurrentCenter].Position.X(), SortedCenters[CurrentCenter].Z.get(), SortedCenters[CurrentCenter].Position.Y());
                Vector3 PlacePosition  = LastPosition + (NextPosition - LastPosition) * (NodesProgress - (int)NodesProgress);
                WorldCamera.MyCamera.SetLookAt(PlacePosition, CenterPosition);

                float FadeA = (Math.Abs((NodesProgress - (int)NodesProgress) - 0.5f) - 0.25f) * 4;
                FadeManager.SetFadeColor(new Vector4(0, 0, 0, FadeA));
            }
            else
            {
                FadeManager.SetFadeColor(new Vector4(0, 0, 0, 1));
                WaveManager.SetState(FadeInState.self);
                FadeInState.SetTargetState(ChooseStartState.self);
            }

            base.Update(gameTime);
        }
コード例 #3
0
        public override void Update(GameTime gameTime)
        {
            if (FadingOut)
            {
                FadeAlpha += FadeAlphaChange * gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f;
                if (FadeAlpha > 1)
                {
                    FadeAlpha = 1;
                    FadingOut = false;
                    if (HasDoneStrike)
                    {
                        SceneObject    s           = GameManager.GetLevel().getCurrentScene();
                        Camera3DObject WorldCamera = (Camera3DObject)s.FindObject(typeof(Camera3DObject));

                        WorldCamera.RemoveTag(GameObjectTag.WorldViewer);
                        GameManager.GetLevel().getCurrentScene().WorldViewerChildren.Remove(WorldCamera);

                        foreach (PlayerShip p in GameManager.GetLevel().getCurrentScene().Enumerate(typeof(PlayerShip)))
                        {
                            p.AddTag(GameObjectTag.WorldViewer);
                        }

                        WaveManager.SetState(FadeInState.self);
                        FadeInState.SetTargetState(WaveStepState.self);
                    }
                    else
                    {
                        SceneObject    s           = GameManager.GetLevel().getCurrentScene();
                        Camera3DObject WorldCamera = (Camera3DObject)s.FindObject(typeof(Camera3DObject));
                        WorldCamera.AddTag(GameObjectTag.WorldViewer);
                        foreach (PlayerShip p in GameManager.GetLevel().getCurrentScene().Enumerate(typeof(PlayerShip)))
                        {
                            p.RemoveTag(GameObjectTag.WorldViewer);
                            GameManager.GetLevel().getCurrentScene().WorldViewerChildren.Remove(p);
                        }
                        WorldCamera.MyCamera.SetLookAt(new Vector3(StrikePosition.X, 1000, StrikePosition.Y), new Vector3(StrikePosition.X, 0, StrikePosition.Y), new Vector3(0, 0, -1));
                    }
                }
            }
            else
            {
                if (FadeAlpha > 0)
                {
                    FadeAlpha -= FadeAlphaChange * gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f;
                    if (FadeAlpha < 0)
                    {
                        FadeAlpha = 0;
                    }
                }
                else
                {
                    if (!HasDoneStrike)
                    {
                        HasDoneStrike = true;
                        WaveManager.CurrentStrike.Trigger(StrikePosition);
                    }
                    else if (WaveManager.CurrentStrike.UpdateStrike(gameTime))
                    {
                        FadingOut = true;
                    }
                }
            }
            FadeManager.SetFadeColor(new Vector4(0, 0, 0, FadeAlpha));
        }