Ejemplo n.º 1
0
    public void SendDamage(Player src, Player target, Vector3 pos, float damage)
    {
        Protocol.HitPlayer hit = new Protocol.HitPlayer();
        hit.sourceId = src.id;
        hit.targetId = target.id;
        hit.damage   = damage;
        hit.hitPosX  = pos.x;
        hit.hitPosY  = pos.y;
        hit.hitPosZ  = pos.z;
        GameMsg msg = new GameMsg(GameMsg.MsgType.Damage, hit);

        Client.SendMessage(msg, UnityEngine.Networking.QosType.ReliableSequenced);
    }
Ejemplo n.º 2
0
 public void SendDamage(Player src, Player target, Vector3 pos, float damage)
 {
     foreach (Connection conn in connDict.Values)
     {
         if (conn.state == ConnState.InGame)
         {
             if (conn.playerId == target.id)
             {
                 Protocol.HitPlayer hit = new Protocol.HitPlayer();
                 hit.sourceId = src.id;
                 hit.targetId = target.id;
                 hit.damage   = damage;
                 hit.hitPosX  = pos.x;
                 hit.hitPosY  = pos.y;
                 hit.hitPosZ  = pos.z;
                 GameMsg msg = new GameMsg(GameMsg.MsgType.Damage, hit);
                 Server.SendMessage(msg, conn.connId, UnityEngine.Networking.QosType.ReliableSequenced);
             }
         }
     }
 }