public override void Enter()
        {
            OverCardPicker.SizeBonus = 0;
            OverMap.SizeMult         = 0;
            CenterCount            = -1;
            CurrentCenter          = 0;
            BlockPlayerWorldViewer = true;
            ProgressSpeed          = 0.005f;
            LastNode = null;
            NextNode = null;

            NodeCount     = 0;
            NodesProgress = 1;
            SortedNodes.Clear();

            SceneObject s = GameManager.GetLevel().getCurrentScene();

            WorldCamera = (Camera3DObject)s.FindObject(typeof(Camera3DObject));

            if (WorldCamera == null)
            {
                s.ParentLevel.AddObject(WorldCamera = new Camera3DObject());
            }

            WorldCamera.RemoveTag(GameObjectTag.Update);

            foreach (CameraFlybyCenter center in s.Enumerate(typeof(CameraFlybyCenter)))
            {
                if (!SortedCenters.ContainsKey(center.CenterOrder.get()))
                {
                    SortedCenters.Add(center.CenterOrder.get(), center);
                    CenterCount = CenterCount > center.CenterOrder.get() ? CenterCount : center.CenterOrder.get();
                }
            }

            foreach (CameraFlybyNode node in s.Enumerate(typeof(CameraFlybyNode)))
            {
                if (!SortedNodes.ContainsKey(node.NodeOrder.get()))
                {
                    SortedNodes[node.NodeOrder.get()] = new List <CameraFlybyNode>();
                }
                SortedNodes[node.NodeOrder.get()].Add(node);
                NodeCount = NodeCount > node.NodeOrder.get() ? NodeCount : node.NodeOrder.get();
            }

            int i = 0;

            while (LastNode == null)
            {
                LastNode = GetNode(i);
                i++;

                if (i > NodeCount)
                {
                    return;
                }
            }

            while (NextNode == null)
            {
                NextNode = GetNode(i);
                i++;

                if (i > NodeCount)
                {
                    return;
                }
            }

            base.Enter();
        }
예제 #2
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));
        }