public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { this.entity = entity; this.entityManager = dstManager; AddComp(new AnimalTypeData { AnimalTypeId = animalType.GetInstanceID(), AnimalName = animalType.Name }); AddComp(new DropOnDeath { Prefab = conversionSystem.GetPrimaryEntity(animalType.Meat) }); AddCompObject(new AnimalPrefab { Prefab = animalType.Baby }); DynamicBuffer <PreyTypesElement> preyBuffer = AddBuffer <PreyTypesElement>(); foreach (AnimalType animalType in animalType.Prey) { if (animalType.GetInstanceID() == this.animalType.GetInstanceID()) { continue; } preyBuffer.Add(new PreyTypesElement { AnimalTypeId = animalType.GetInstanceID() }); } DynamicBuffer <FoodTypesElement> foodBuffer = AddBuffer <FoodTypesElement>(); foreach (FoodType foodType in animalType.Food) { if (foodType.GetInstanceID() == this.animalType.Meat.GetInstanceID()) { continue; } foodBuffer.Add(new FoodTypesElement { FoodTypeId = foodType.GetInstanceID() }); } AddComp(new BaseSpeed { Value = animalType.MovementSpeed }); AddComp(new BaseHearingRange { Value = animalType.HearingRange }); AddComp(new BaseVisionRange { Value = animalType.VisionRange }); AddComp(new MovementSpeed()); AddComp(new Hearing()); AddComp(new Vision { Angle = animalType.VisionAngle, Range = 0 }); if (animalType.MaxHunger > 0) { AddComp(new HungerData { Hunger = animalType.MaxHunger * startingHunger }); } AddComp(new MaxHungerData { MaxHunger = animalType.MaxHunger }); AddComp(new HungerLimit { Value = animalType.HungerLimit }); if (animalType.MaxThirst > 0) { AddComp(new ThirstData { Thirst = animalType.MaxThirst * startingThirst }); } AddComp(new MaxThirstData { MaxThirst = animalType.MaxThirst }); AddComp(new ThirstLimit { Value = animalType.ThirstLimit }); if (animalType.MaxSexualUrge > 0) { AddComp(new SexualUrgesData { Urge = animalType.MaxSexualUrge * startingSexualUrge }); } AddComp(new MaxSexualUrgesData { MaxUrge = animalType.MaxSexualUrge }); AddComp(new MatingLimit { Value = animalType.MatingLimit }); AddComp(new BraveryData { Value = animalType.Bravery }); AddComp(new LifespanData { Value = animalType.Lifespan }); AddComp(new InfertilityData { InfertilityAge = animalType.Lifespan * animalType.InfertilityAge }); AddComp(new GestationData { GestationPeriod = animalType.GestationPeriod }); AddComp(new MovementTerrain { MovesOnLand = animalType.Land, MovesOnWater = animalType.Water }); }