コード例 #1
0
        private void PickUpPowerUp(RoomItem item, RoomUser user)
        {
            switch (item.freezePowerUp)
            {
            case FreezePowerUp.BlueArrow:
            case FreezePowerUp.GreenArrow:
            case FreezePowerUp.OrangeSnowball:
                user.banzaiPowerUp = item.freezePowerUp;
                break;

            case FreezePowerUp.Shield:
                Freeze.ActivateShield(user);
                break;

            case FreezePowerUp.Heart:
                if (user.FreezeLives < 5)
                {
                    checked { ++user.FreezeLives; }
                    this.room.GetGameManager().AddPointToTeam(user.team, 10, user);
                }
                ServerMessage serverMessage = new ServerMessage();
                serverMessage.Init(Outgoing.UpdateFreezeLivesMessageComposer);
                serverMessage.AppendInt32(user.InternalRoomID);
                serverMessage.AppendInt32(user.FreezeLives);
                user.GetClient().SendMessage(serverMessage);
                break;
            }
            item.freezePowerUp = FreezePowerUp.None;
            item.ExtraData     = "1" + item.ExtraData;
            item.UpdateState(false, true);
        }
コード例 #2
0
 internal void CycleUser(RoomUser user)
 {
     if (user.Freezed)
     {
         checked { ++user.FreezeCounter; }
         if (user.FreezeCounter > 10)
         {
             user.Freezed       = false;
             user.FreezeCounter = 0;
             Freeze.ActivateShield(user);
         }
     }
     if (!user.shieldActive)
     {
         return;
     }
     checked { ++user.shieldCounter; }
     if (user.shieldCounter > 10)
     {
         user.shieldActive  = false;
         user.shieldCounter = 10;
         user.ApplyEffect((int)(user.team + 39));
     }
 }
コード例 #3
0
        private List <RoomItem> GetDiagonalItems(int x, int y, int length)
        {
            List <RoomItem> list = new List <RoomItem>();
            int             num1 = 0;
            Point           point;

            while (num1 < length)
            {
                point = new Point(checked (x + num1), checked (y + num1));
                List <RoomItem> itemsForSquare = this.GetItemsForSquare(point);
                if (Freeze.SquareGotFreezeTile(itemsForSquare))
                {
                    this.HandleUserFreeze(point);
                    list.AddRange((IEnumerable <RoomItem>)itemsForSquare);
                    if (!Freeze.SquareGotFreezeBlock(itemsForSquare))
                    {
                        checked { ++num1; }
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            int num2 = 0;

            while (num2 < length)
            {
                point = new Point(checked (x - num2), checked (y - num2));
                List <RoomItem> itemsForSquare = this.GetItemsForSquare(point);
                if (Freeze.SquareGotFreezeTile(itemsForSquare))
                {
                    this.HandleUserFreeze(point);
                    list.AddRange((IEnumerable <RoomItem>)itemsForSquare);
                    if (!Freeze.SquareGotFreezeBlock(itemsForSquare))
                    {
                        checked { ++num2; }
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            int num3 = 0;

            while (num3 < length)
            {
                point = new Point(checked (x - num3), checked (y + num3));
                List <RoomItem> itemsForSquare = this.GetItemsForSquare(point);
                if (Freeze.SquareGotFreezeTile(itemsForSquare))
                {
                    this.HandleUserFreeze(point);
                    list.AddRange((IEnumerable <RoomItem>)itemsForSquare);
                    if (!Freeze.SquareGotFreezeBlock(itemsForSquare))
                    {
                        checked { ++num3; }
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            int num4 = 0;

            while (num4 < length)
            {
                point = new Point(checked (x + num4), checked (y - num4));
                List <RoomItem> itemsForSquare = this.GetItemsForSquare(point);
                if (Freeze.SquareGotFreezeTile(itemsForSquare))
                {
                    this.HandleUserFreeze(point);
                    list.AddRange((IEnumerable <RoomItem>)itemsForSquare);
                    if (!Freeze.SquareGotFreezeBlock(itemsForSquare))
                    {
                        checked { ++num4; }
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            return(list);
        }