Exemplo n.º 1
0
    public static Packet BuildUnbindOffensiveItem(int guid, Config.PowerType powertype)
    {
        Packet p = new Packet(4, Opcode.SMSG_OFF_POWER_USED);

        p.Write(guid);
        p.Write((int)powertype);
        return(p);
    }
Exemplo n.º 2
0
    public static void HandleOffensivePowerDrop(Packet p)
    {
        int guid;

        guid = p.ReadInt();
        Config.PowerType powertype = (Config.PowerType)p.ReadInt();

        if (current.Guid == guid)
        {
            HUD hud = GameObject.Find("HUD").GetComponent <HUD>();
            hud.unBindOffensivePower();
        }

        GameObject go = ObjectMgr.Instance.Get(guid);

        go.GetComponent <BomberController>().Swing();
    }
Exemplo n.º 3
0
 public void BindDefensivePower(Config.PowerType powertype)
 {
     hasDefensivePower = true;
     defensivePower    = powertype;
 }
Exemplo n.º 4
0
 public void BindOffensivePower(Config.PowerType powertype)
 {
     hasOffensivePower = true;
     offensivePower    = powertype;
 }
Exemplo n.º 5
0
    public void KillPlayer(int victim, int killer, Config.PowerType powertype)
    {
        Debug.Log("In kill player by sword");

        IList <GameObject> m_player = ObjectMgr.Instance.Get(GOType.GO_PLAYER);

        int[] scores = hud.getScores();

        // VODKA_CODE_LIKE {

        /*for (int i = 0, len = m_player.Count; i < len; i++)
         * {
         *  int curId = m_player[i].GetComponent<Guid>().GetGUID();
         *  if (curId == victim)
         *  {
         *      PlayAnnounce(Announce.ANNOUNCE_KILL_BY_SW, 0, "" + (i + 1));
         *      if (this.gameIntel.game_mode == Config.GameMode.SURVIVAL)
         *      {
         *          scores = hud.getScores();
         *          scores[i] = -1;
         *          hud.setScores(scores);
         *          s.SendPacketBroadCast(PacketBuilder.BuildPlayerDespawn(victim));
         *          this.Despawn(victim);
         *          nbDeads++;
         *
         *          if (nbDeads == this.s.client_count - 1)
         *          {
         *              if ((this.type & GameMgrType.SERVER) != 0)
         *              {
         *                  this.s.SendPacketBroadCast(PacketBuilder.BuildSendEndOfGame((int)GameMgr.Instance.gameIntel.game_mode));
         *                  EndGame(GameMgr.Instance.gameIntel.game_mode);
         *              }
         *          }
         *      }
         *      else
         *      {
         *          RespawnPlayer(victim);
         *      }
         *
         *
         *  }
         *  else if (curId == killer)
         *  {
         *
         *      //s.SendPacketTo(GameMgr.Instance.s.GetTcpClient(killer), PacketBuilder.BuildPlayAnnouncePacket(Announce.ANNOUNCE_KILL_BY_SW, 1, "" + (i + 1)));
         *
         *  }
         *
         *
         * }
         */
        int sessionID       = GameMgr.Instance.s.GetSessionId(killer);
        int sessionIDVictim = GameMgr.Instance.s.GetSessionId(victim);

        scores[sessionID - 1]++;
        PlayAnnounce(Announce.ANNOUNCE_KILL_BY_SW, 0, "" + (sessionIDVictim));
        if (this.gameIntel.game_mode == Config.GameMode.SURVIVAL)
        {
            scores[sessionIDVictim] = -1;
            s.SendPacketBroadCast(PacketBuilder.BuildPlayerDespawn(victim));
            this.Despawn(victim);
            nbDeads++;
            if (nbDeads == this.s.client_count - 1)
            {
                if ((this.type & GameMgrType.SERVER) != 0)
                {
                    hud.setScores(scores);
                    this.s.SendPacketBroadCast(PacketBuilder.BuildSendEndOfGame((int)GameMgr.Instance.gameIntel.game_mode));
                    EndGame(GameMgr.Instance.gameIntel.game_mode);
                }
            }
        }
        else
        {
            RespawnPlayer(victim);
        }
        hud.setScores(scores);
        s.SendPacketBroadCast(PacketBuilder.BuildUpdateScoresPacket(scores));
    }