public PlayerProfile(SignedInGamer MyGamer, BasicController MyController, ControllerIndex controllerIndex)
        {
            if (MyGamer != null)
            {
                PlayerName = MyGamer.DisplayName;
            }

            this.MyGamer         = MyGamer;
            this.MyController    = MyController;
            this.controllerIndex = controllerIndex;
        }
예제 #2
0
 public bool Update(GameTime gameTime, BasicController MyController)
 {
     if (CurrentMenu != null)
     {
         CurrentMenu.Update(gameTime, MyController);
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public static void Update(GameTime gameTime)
 {
     if (GameManager.GetLevel() == null)
     {
         if (PlayerProfile.getController(0) == null)
         {
             PlayerProfile.Update(gameTime, true);
             if (PlayerProfile.getController(0) != null)
             {
                 setMessage("Press A to search for connection");
             }
         }
         else
         {
             PlayerProfile.Update(gameTime, false);
             if (NetworkManager.networkSession == null)
             {
                 BasicController b = PlayerProfile.getController(0);
                 if (b.AButton())
                 {
                     setMessage("Attempting to Join...");
                     if (NetworkManager.JoinSession())
                     {
                         setMessage("Sucess");
                     }
                     else
                     {
                         setMessage("Failure to Connect");
                     }
                 }
             }
             else
             {
                 NetworkManager.Update(gameTime);
             }
         }
     }
     else
     {
         if (!PlayerProfile.getController(0).BackButton())
         {
             GameManager.Update(gameTime);
             FPSCounter.Update(gameTime);
         }
         else
         {
             GameManager.ClearLevel();
         }
     }
 }
        public override void Update(GameTime gameTime, BasicController MyController)
        {
            LinkedListNode <TechTreeGroup> NextNode = Groups.First;

            do
            {
                if (NextNode != null)
                {
                    NextNode.Value.Update(gameTime, MyController, NextNode.Value == CurrentGroup);
                    NextNode = NextNode.Next;
                }
                else
                {
                    break;
                }
            }while (NextNode != null);


            base.Update(gameTime, MyController);
        }
        public static PlayerProfile AddPlayer(BasicController controller, SignedInGamer gamer, ControllerIndex controllerIndex)
        {
            PlayerProfile newProfile = new PlayerProfile(gamer, controller, controllerIndex);

            bool Found = false;

            if (controllerIndex != ControllerIndex.AI && controllerIndex != ControllerIndex.Online)
            {
                for (int i = 0; i < Players.Count; i++)
                {
                    if (controllerIndex == Players[i].controllerIndex)
                    {
                        Players[i] = newProfile;
                        newProfile.SetPlayerNumber(i);
                        Found = true;
#if WINDOWS
                        if (!GameManager.GetLevel().LevelForEditing)
#endif
                        GameManager.GetLevel().PlayerJoinedEvent(newProfile);

                        PlayerJoinMessage(newProfile);
                        return(newProfile);
                    }
                }
            }

            if (!Found && Players.Count < MaxPlayers)
            {
                newProfile.SetPlayerNumber(Players.Count);
                Players.Add(newProfile);
#if WINDOWS
                if (!GameManager.GetLevel().LevelForEditing)
#endif
                GameManager.GetLevel().PlayerJoinedEvent(newProfile);

                PlayerJoinMessage(newProfile);
                return(newProfile);
            }
            return(null);
        }
        private static void TestSignIn(object o, SignedInEventArgs e)
        {
            BasicController b = null;
            ControllerIndex c = ControllerIndex.Keyboard;

#if EDITOR && WINDOWS
            if (signInState == SignInState.Controller)
            {
#endif
            b = new XboxController(e.Gamer.PlayerIndex);
            c = Convert(e.Gamer.PlayerIndex);
#if EDITOR && WINDOWS
        }

        else
        {
            b = new KeyboardController();
        }
#endif

            AddPlayer(b, e.Gamer, c);
        }
        public void Update(GameTime gameTime, BasicController MyController)
        {
            if (Bombs.Count > 0 && FactionManager.TeamCount > 1)
            {
                Bombs.Clear();
            }

            SmallBombDelay += gameTime.ElapsedGameTime.Milliseconds;

            if (Bombs.Count > 0)
            {
                if (MyController.LeftTrigger())
                {
                    BigBombTime += gameTime.ElapsedGameTime.Milliseconds;
                    if (BigBombTime > MaxBigBombTime)
                    {
                        Bombs.First.Value.Trigger(ParentShip);
                        Bombs.Remove(Bombs.First);
                    }
                }
                else
                {
                    BigBombTime = 0;
                }
            }

            if (ParentShip.viewMode == ViewMode.Ship && !ParentShip.IsTeleporting &&
                ((!MyController.IsKeyboardController() && MyController.RightTrigger() && !MyController.RightTriggerPrevious()) ||
                 (MyController.IsKeyboardController() && MyController.LeftTrigger() && !MyController.LeftTriggerPrevious())) &&
                ParentShip.Guns != null && ParentShip.Guns[0] != null && BombLauncher.Ammo > 0 && SmallBombDelay > MaxSmallBombDelay)
            {
                SmallBombDelay = 0;
                FactionManager.Factions[ParentShip.FactionNumber].roundReport.SmallBombsUsed++;
                BombLauncher.Fire(ParentShip.Guns[0].Rotation);
            }
        }
 public virtual void Update(GameTime gameTime, BasicController MyController)
 {
 }
예제 #9
0
        public void Update(GameTime gameTime, BasicController MyController, bool Highlighted)
        {
            if (Highlighted && !ParentMenu.Closing)
            {
                TargetPosition = ParentMenu.Position - TechTreeMenu.NegativeOffset - new Vector2(0, Size.Y / 2);
                Position      += (TargetPosition - Position) * gameTime.ElapsedGameTime.Milliseconds * PlayerMenu.CloseOpenSpeed * 2;
                Alpha          = Math.Min(1, Alpha + gameTime.ElapsedGameTime.Milliseconds * PlayerMenu.CloseOpenSpeed * 2);
                if (Alpha > 0.5f)
                {
                    Vector2 CursorPrevious = Cursor;
                    bool    ExtraSticks    = FactionManager.GetFaction(ParentMenu.ParentShip.FactionNumber).PickingCards;
                    Cursor += MyController.MenuStick(ExtraSticks, ExtraSticks, true, false, false);

                    if (ExtraSticks)
                    {
                        Vector2 BumperCursorPrevious = BumperCursor;
                        BumperCursor = MyController.MenuStick(false, false, false, true, true);
                        if (Math.Abs(BumperCursor.X) > 0.1f && Math.Abs(BumperCursor.X) < 0.1f)
                        {
                            Faction f = FactionManager.GetFaction(ParentMenu.ParentShip.FactionNumber);
                            if (BumperCursor.X > 0)
                            {
                                f.CardPickPosition++;
                                if (f.CardPickPosition == f.Cards.Count)
                                {
                                    ParentMenu.ParentShip.ReadyMenu();
                                }
                            }
                            else
                            {
                                f.CardPickPosition = Math.Max(0, f.CardPickPosition - 1);
                            }
                        }
                    }

                    if (Cursor.Y != 0 && ParentMenu.MyFaction.PickingCards)
                    {
                        if (Cursor.Y < 0)
                        {
                            TechTreeGroup PreviousGroup = MyNode.Previous != null ? MyNode.Previous.Value : MyNode.List.Last.Value;
                            if (PreviousGroup.Cards != null && PreviousGroup.Cards.Count > 0)
                            {
                                PreviousGroup.Cursor.X = Cursor.X;
                                PreviousGroup.Position = Position - new Vector2(0, PreviousGroup.Size.Y);
                                ParentMenu.SetGroup(PreviousGroup);
                                PreviousGroup.SwitchTo();
                            }
                        }
                        else if (Cursor.Y > 0)
                        {
                            TechTreeGroup NextGroup = MyNode.Next != null ? MyNode.Next.Value : MyNode.List.First.Value;
                            if (NextGroup.Cards != null && NextGroup.Cards.Count > 0)
                            {
                                NextGroup.Cursor.X = Cursor.X;
                                NextGroup.Position = Position + new Vector2(0, Size.Y);
                                ParentMenu.SetGroup(NextGroup);
                                NextGroup.SwitchTo();
                            }
                        }
                        Cursor.Y = 0;
                    }
                    Cursor.X = MathHelper.Clamp(Cursor.X, 0, Cards.Count - 1);

                    int i = 0;
                    foreach (FactionCard c in Cards)
                    {
                        c.MenuUpdate(gameTime, (int)Cursor.X == i, 1 - Math.Abs(Cursor.X - i++) / 2.25f);
                    }

                    Vector2 TargetOffset = -new Vector2((Cursor.X - 2) * CellBorders.X, -CellBorders.Y / 2f);
                    DrawOffset += (TargetOffset - DrawOffset) * OffsetSpeed;

                    HighlightedCard = Cards[(int)Cursor.X];
                    if (MyController.AButton() && !MyController.AButtonPrevious())
                    {
                    }
                    HighlightedCard.Update3D(ParentMenu.ParentShip);
                }
            }
            else
            {
                Alpha = Math.Max(0, Alpha - gameTime.ElapsedGameTime.Milliseconds * PlayerMenu.CloseOpenSpeed);
            }
        }
예제 #10
0
        public override void Update(GameTime gameTime, BasicController MyController)
        {
            if (!Dashing)
            {
                RechargeTime += gameTime.ElapsedGameTime.Milliseconds;
                if (MyController.LeftStick().Length() > 0.1f)
                {
                    DashVector = Vector2.Normalize(MyController.LeftStick() * new Vector2(1, -1));
                }
            }
            else
            {
                ParentShip.AddPosition(DashVector * DashSpeed * gameTime.ElapsedGameTime.Milliseconds / 1000f * 60f);
                ParentShip.InvTime = Math.Max(ParentShip.InvTime, 400);
                DashTime          += gameTime.ElapsedGameTime.Milliseconds;

                if (DashTime > MaxDashTime)
                {
                    bool PositionClear = true;
                    foreach (Basic2DObject s in ParentShip.Parent2DScene.quadGrids.First.Value.Enumerate(
                                 ParentShip.Position.get(), new Vector2(ParentShip.PlayerSize)))
                    {
                        if (s != ParentShip)
                        {
                            if (s.GetType().IsSubclassOf(typeof(BasicShipGameObject)))
                            {
                                if (Vector2.Distance(ParentShip.getPosition(), s.getPosition()) < (ParentShip.PlayerSize + s.getSize().X) / 2)
                                {
                                    BasicShipGameObject b = (BasicShipGameObject)s;
                                    if (b.Solid)
                                    {
                                        PositionClear = false;
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                WallNode n = (WallNode)s;
                                if (n.wallConnector != null)
                                {
                                    float MoveAmount = (ParentShip.PlayerSize + s.getSize().X * 0.75f) / 2 - Logic.DistanceLineSegmentToPoint(n.Position.get(), n.wallConnector.PositionNext, ParentShip.Position.get());

                                    if (MoveAmount > 0)
                                    {
                                        PositionClear = false;
                                        break;
                                    }
                                }
                            }
                        }
                    }

                    if (PositionClear && Dashing)
                    {
                        SoundManager.Play3DSound("PlayerDashReverse",
                                                 new Vector3(ParentShip.Position.X(), ParentShip.Y, ParentShip.Position.Y()), 0.2f, 300, 2);

                        Dashing = false;
                        Vector3 Position3 = new Vector3(ParentShip.Position.X(), ParentShip.Y, ParentShip.Position.Y());
                        ParticleManager.CreateParticle(Position3, Vector3.Zero, PlayerShip.TeleportColor2, ParentShip.Size.X() * 5, 4);
                        for (int i = 0; i < 30; i++)
                        {
                            ParticleManager.CreateParticle(Position3, Rand.V3() * 200, PlayerShip.TeleportColor2, 20, 5);
                        }
                    }
                }
            }

            base.Update(gameTime, MyController);
        }