public static AttackProperties ReadFrom(BinaryReader reader)
        {
            var result = new AttackProperties();

            result.AttackRange     = reader.ReadInt32();
            result.Damage          = reader.ReadInt32();
            result.CollectResource = reader.ReadBoolean();
            return(result);
        }
예제 #2
0
        public static EntityProperties ReadFrom(BinaryReader reader)
        {
            var result = new EntityProperties();

            result.Size              = reader.ReadInt32();
            result.BuildScore        = reader.ReadInt32();
            result.DestroyScore      = reader.ReadInt32();
            result.CanMove           = reader.ReadBoolean();
            result.PopulationProvide = reader.ReadInt32();
            result.PopulationUse     = reader.ReadInt32();
            result.MaxHealth         = reader.ReadInt32();
            result.InitialCost       = reader.ReadInt32();
            result.SightRange        = reader.ReadInt32();
            result.ResourcePerHealth = reader.ReadInt32();
            if (reader.ReadBoolean())
            {
                result.Build = BuildProperties.ReadFrom(reader);
            }
            else
            {
                result.Build = null;
            }

            if (reader.ReadBoolean())
            {
                result.Attack = AttackProperties.ReadFrom(reader);
            }
            else
            {
                result.Attack = null;
            }

            if (reader.ReadBoolean())
            {
                result.Repair = RepairProperties.ReadFrom(reader);
            }
            else
            {
                result.Repair = null;
            }

            return(result);
        }