AddBuilding() публичный Метод

public AddBuilding ( int type, Vector2 pos ) : RTSBuilding
type int
pos Vector2
Результат RTSBuilding
Пример #1
0
        public static RTSBuilding Deserialize(BinaryReader s, RTSTeam team, out int?target)
        {
            int         type = s.ReadInt32();
            RTSBuilding e    = team.AddBuilding(type, Vector2.Zero);

            if (e == null)
            {
                throw new Exception("Could Not Create A Building That Was Previously Created");
            }
            e.UUID          = s.ReadInt32();
            e.State         = s.ReadInt32();
            e.ViewDirection = s.ReadVector2();
            e.GridPosition  = s.ReadVector2();
            e.Height        = s.ReadSingle();
            if (s.ReadBoolean())
            {
                target = s.ReadInt32();
            }
            else
            {
                target = null;
            }
            e.Health = s.ReadInt32();
            for (int i = 0; i < GameState.MAX_PLAYERS; i++)
            {
                e.viewedInfo.Set(i, s.ReadBoolean());
            }
            if (s.ReadBoolean())
            {
                if (e.ActionController != null)
                {
                    e.ActionController.Deserialize(s);
                }
            }
            else
            {
                e.ActionController = null;
            }
            return(e);
        }
Пример #2
0
 public static RTSBuilding Deserialize(BinaryReader s, RTSTeam team, out int? target)
 {
     int type = s.ReadInt32();
     RTSBuilding e = team.AddBuilding(type, Vector2.Zero);
     if(e == null) throw new Exception("Could Not Create A Building That Was Previously Created");
     e.UUID = s.ReadInt32();
     e.State = s.ReadInt32();
     e.ViewDirection = s.ReadVector2();
     e.GridPosition = s.ReadVector2();
     e.Height = s.ReadSingle();
     if(s.ReadBoolean()) {
         target = s.ReadInt32();
     }
     else {
         target = null;
     }
     e.Health = s.ReadInt32();
     for(int i = 0; i < GameState.MAX_PLAYERS; i++) {
         e.viewedInfo.Set(i, s.ReadBoolean());
     }
     if(s.ReadBoolean()) {
         if(e.ActionController != null) e.ActionController.Deserialize(s);
     }
     else {
         e.ActionController = null;
     }
     return e;
 }