Esempio n. 1
0
 public ArrowListState(ArrowList arrowList)
 {
     MaxArrows = arrowList.MaxArrows;
     Arrows    = arrowList.Arrows;
     Count     = arrowList.Count;
     HasArrows = arrowList.HasArrows;
 }
Esempio n. 2
0
        public Player FinishReviving()
        {
            Vector2 zero = Vector2.Zero;
            Player  result;

            if (this.Corpse.Squished == Vector2.Zero && this.CanReviveAtThisPosition(ref zero))
            {
                PlayerInventory inventory = new PlayerInventory(false, false, false, false, new ArrowList(this.Corpse.Arrows));
                // this.Corpse.Arrows.Clear (); // I don't know what this line does, but it was causing an accessibility exception
                if (this.Corpse.ArrowCushion.Count > 0)
                {
                    Arrow arrow = this.Corpse.ArrowCushion.ArrowDatas [0].Arrow;
                    if (inventory.Arrows.CanAddArrow(arrow.ArrowType) && arrow.Scene != null && !arrow.MarkedForRemoval)
                    {
                        base.Level.Remove <Arrow> (arrow);
                        inventory.Arrows.AddArrows(new ArrowTypes[] {
                            arrow.ArrowType
                        });
                    }
                    this.Corpse.ArrowCushion.ReleaseArrows(Vector2.UnitY * -1f);
                }
                if (this.Mode == TeamReviver.Modes.Quest && inventory.Arrows.Count == 0)
                {
                    ArrowList    arg_153_0 = inventory.Arrows;
                    ArrowTypes[] arrows    = new ArrowTypes[1];
                    arg_153_0.AddArrows(arrows);
                }
                Vector2 position = zero;
                Player  player   = new Player(this.Corpse.PlayerIndex, position, this.Corpse.Allegiance, this.Corpse.TeamColor, inventory, Player.HatStates.NoHat, true, false, false);
                if (this.Mode == TeamReviver.Modes.TeamDeathmatch)
                {
                    player.Flash(45, null);
                }
                else
                {
                    player.Flash(135, null);
                }
                base.Level.Add <Player> (player);
                //if (((MyMatchVariants)base.Level.Session.MatchSettings.Variants).GottaBustGhosts) {
                //   ((MySession)base.Level.Session).OnTeamRevive(player);
                //}
                int playerIndex = this.reviver;
                if (playerIndex == -1)
                {
                    playerIndex = player.PlayerIndex;
                }
                if (this.Mode == TeamReviver.Modes.DarkWorld)
                {
                    Player player2 = base.Level.GetPlayer(this.reviver);
                    if (player2 != null)
                    {
                        player2.Flash(60, null);
                    }
                }
                ShockCircle shockCircle = Cache.Create <ShockCircle> ();
                shockCircle.Init(position, playerIndex, player, ShockCircle.ShockTypes.TeamRevive);
                base.Level.Add <ShockCircle> (shockCircle);
                int num = Calc.Random.Next(360);
                for (int i = num; i < num + 360; i += 30)
                {
                    base.Level.Add <BombParticle> (new BombParticle(position, (float)i, BombParticle.Type.TeamRevive));
                }
                TFGame.PlayerInputs [this.Corpse.PlayerIndex].Rumble(1f, 30);
                if (this.reviver != -1)
                {
                    TFGame.PlayerInputs [this.reviver].Rumble(0.5f, 30);
                }
                if (this.reviver != -1)
                {
                    MatchStats[] expr_2FA_cp_0 = base.Level.Session.MatchStats;
                    int          expr_2FA_cp_1 = this.reviver;
                    expr_2FA_cp_0 [expr_2FA_cp_1].Revives = expr_2FA_cp_0 [expr_2FA_cp_1].Revives + 1u;
                    if (base.Level.Session.DarkWorldState != null)
                    {
                        base.Level.Session.DarkWorldState.Revives [this.reviver]++;
                    }
                }
                this.reviveCounter = 0f;
                if (this.Corpse.TeamColor == Allegiance.Red)
                {
                    Sounds.sfx_reviveRedteamFinish.Play(210f, 1f);
                }
                else
                {
                    Sounds.sfx_reviveBlueteamFinish.Play(210f, 1f);
                }
                result = player;
            }
            else
            {
                result = null;
            }

            // If ghost revives is on, then a revive can cancel a level ending

            if (this.ghostRevives && base.Level.Session.MatchSettings.Mode == Modes.TeamDeathmatch)
            {
                Allegiance allegiance;
                if (!base.Level.Session.RoundLogic.TeamCheckForRoundOver(out allegiance))
                {
                    base.Level.Session.CurrentLevel.Ending = false;
                }
            }

            return(result);
        }