/// <summary>
        /// Génère le code réseau pour envoyer la list des unites
        /// </summary>
        /// <param name="info">les infos sur l'entité</param>
        /// <returns>bytes à envoyer sur le réseau</returns>
        public Byte[] Entity_sendinfo(Information info)
        {
            Byte[] bname = Encoding.ASCII.GetBytes(info._entityName);

            int i = 0;
            Byte[] bytes = new Byte[15 + bname.Length];
            setType(ref bytes, ref i, ServerProtocol.UNIT_GETINFO);
            addInt16(ref bytes, ref i, info._idPlayer);
            addInt16(ref bytes, ref i, info._idEntity);
            addInt32(ref bytes, ref i, info._energy);
            addInt16(ref bytes, ref i, info._hitPoints);
            addInt16(ref bytes, ref i, info._hitPointsMax);
            bytes[14] = (byte)bname.Length;
            System.Buffer.BlockCopy(bname, 0, bytes, 15, bname.Length);
            return (bytes);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// retourne les information sur l'entité
 /// </summary>
 /// <param name="IdEntity"> identifiant de l'entité</param>
 /// <returns> information </returns>
 public Information getInformationEntity(int IdEntity)
 {
     Information inf = new Information();
     foreach (Player p in this._players)
     {
         inf = p.getInformationEntity(IdEntity);
     }
     return inf;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// suppression de l'entité ce (mort)
 /// </summary>
 /// <param name="ce">Concrete entity</param>
 /*public void killEntity(ConcreteEntity ce)
 {
     foreach (ConcreteEntity c in this._ListEntity)
     {
         if (c.Equals(ce))
         {
             // suppimer la concrete entity
             Server.components.entities.Entities.getInstance().pullEntitySpec(ce.getIDEntity());
         }
     }
 }*/
 /// <summary>
 /// retourne une structure d'information sur l'netité
 /// </summary>
 /// <param name="IdEntity"> identifiant de l'entité</param>
 /// <returns> structure d'information </returns>
 public Information getInformationEntity(int IdEntity)
 {
     Information inf = new Information();
     PlayableConcreteEntity pce;
     foreach (PlayableConcreteEntity ce in this._ListEntity)
     {
         if (ce.IDEntity == IdEntity)
         {
             pce = (PlayableConcreteEntity) ce;
             //initialisation de la structure information
             inf = new Information(this._idPlayer, (uint)pce.IDEntity, pce.Name, pce.HpMax, pce.Hp, pce.Energy);
         }
     }
     return inf;
 }