public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var renderedArray = dstManager.AddBuffer <RenderingElement>(entity); if (UseCustomRenderingSequence) { foreach (var renderedGo in CustomRenderingSequence) { if (renderedGo == null) { continue; } var childEntity = conversionSystem.GetPrimaryEntity(renderedGo); renderedArray.Add(new RenderingElement { Target = childEntity }); } } else { foreach (Transform child in transform) { var childEntity = conversionSystem.GetPrimaryEntity(child.gameObject); renderedArray.Add(new RenderingElement { Target = childEntity }); } } }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { _prefabEntityBody = conversionSystem.GetPrimaryEntity(prefabBody); _prefabEntityGroin = conversionSystem.GetPrimaryEntity(prefabGroin); _prefabEntityThigh = conversionSystem.GetPrimaryEntity(prefabThigh); _prefabEntityShin = conversionSystem.GetPrimaryEntity(prefabShin); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var startEntity = conversionSystem.GetPrimaryEntity(start); dstManager.AddComponentData <StartMessage>(entity, new StartMessage { Value = startEntity }); var contiEntity = conversionSystem.GetPrimaryEntity(conti); dstManager.AddComponentData <ContinueMessage>(entity, new ContinueMessage { Value = contiEntity }); var defaultEntity = conversionSystem.GetPrimaryEntity(def); dstManager.AddComponentData <DefaultMessage>(entity, new DefaultMessage { Value = defaultEntity }); dstManager.AddComponent <MessageTag>(entity); }
public void Convert(Entity spawnerEntity, EntityManager em, GameObjectConversionSystem conversionSystem) { spawnerEntitiesPrefabs = new SpawnerEntityPrefabsData { // The referenced prefab will be converted due to DeclareReferencedPrefabs. // So here we simply map the game object to an entity reference to that prefab. defaultEntity = conversionSystem.GetPrimaryEntity(prefabDefault), higlightEntity = conversionSystem.GetPrimaryEntity(prefabHiglight), boundingBoxEntity = conversionSystem.GetPrimaryEntity(boundingBox), prefab01Entity = conversionSystem.GetPrimaryEntity(prefabBlock01) }; SpawnerMeshData spawnerMeshData = new SpawnerMeshData() { defaultMesh = em.GetSharedComponentData <RenderMesh> (spawnerEntitiesPrefabs.defaultEntity), higlightMesh = em.GetSharedComponentData <RenderMesh> (spawnerEntitiesPrefabs.higlightEntity), boundingBoxMesh = em.GetSharedComponentData <RenderMesh> (spawnerEntitiesPrefabs.boundingBoxEntity), prefab01Mesh = em.GetSharedComponentData <RenderMesh> (spawnerEntitiesPrefabs.prefab01Entity) }; _SetPrefabComponents(em, spawnerEntitiesPrefabs.defaultEntity, MeshType.Default); _SetPrefabComponents(em, spawnerEntitiesPrefabs.higlightEntity, MeshType.Highlight); _SetPrefabComponents(em, spawnerEntitiesPrefabs.boundingBoxEntity, MeshType.BoundingBox); _SetPrefabComponents(em, spawnerEntitiesPrefabs.prefab01Entity, MeshType.Prefab01); em.AddComponentData(spawnerEntity, spawnerEntitiesPrefabs); var postBootstrapSystem = World.Active.GetOrCreateSystem <Octree.PostBootstrapSystem> (); postBootstrapSystem.Update(); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { // As we can't store the particle system directly on conversion // we are just going to store the path in the asset database // and extract it later to load var assetLocation = particles.AssetGUID; var data = new GameOfLifeConfig() { NumberOfStartingSeeds = this.NumberOfStartingSeeds, WorldSize = this.WorldSize, WorldSeed = this.WorldSeed, WorldUpdateRate = this.WorldUpdateRate, LimitUpdateRate = this.LimitUpdateRate, AliveCell = conversionSystem.GetPrimaryEntity(this.AliveCell), DeadCell = conversionSystem.GetPrimaryEntity(this.DeadCell), Centre = this.transform.position, SystemToUse = this.SystemToUse, particleAsset = new NativeString512(assetLocation), MaxParticles = MaxParticles, ruleSet = RuleSet }; dstManager.AddComponentData(entity, data); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponent <UINumbers>(entity); dstManager.AddBuffer <UINumberMaterial>(entity); if (!conversionSystem.TryGetBuildConfigurationComponent <DotsRuntimeBuildProfile>(out var _)) { return; } //Add additional entity for the Empty material var primaryEntity = conversionSystem.GetPrimaryEntity(Empty); var mat = dstManager.GetComponentData <SimpleMaterial>(primaryEntity); Entity additionalEntity = conversionSystem.CreateAdditionalEntity(Empty); dstManager.AddComponentData <SimpleMaterial>(additionalEntity, mat); //Add additional entities for each numbers material for (int i = 0; i < Numbers.Length; i++) { primaryEntity = conversionSystem.GetPrimaryEntity(Numbers[i]); mat = dstManager.GetComponentData <SimpleMaterial>(primaryEntity); additionalEntity = conversionSystem.CreateAdditionalEntity(Numbers[i]); dstManager.AddComponentData <SimpleMaterial>(additionalEntity, mat); } }
void IConvertGameObjectToEntity.Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var sourceEntity = conversionSystem.GetPrimaryEntity(boxPrefab); if (sourceEntity == null) { return; } var boxSize = float3.zero; var renderer = boxPrefab.GetComponent <Renderer>(); if (renderer != null) { boxSize = renderer.bounds.size; } var createPyramids = new CreatePyramids { BoxEntity = conversionSystem.GetPrimaryEntity(boxPrefab), Count = Count, Height = Height, Space = Space, StartPosition = transform.position, BoxSize = boxSize }; dstManager.AddComponentData <CreatePyramids>(entity, createPyramids); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { Entity prefabEntity = conversionSystem.GetPrimaryEntity(IcospherePrefab); dstManager.AddComponentData(prefabEntity, new SpikeReference { Entity = conversionSystem.GetPrimaryEntity(spike) }); dstManager.AddComponentData(entity, new SphereSpawner() { Prefab = prefabEntity, SpawnPositionY = SpawnPositionY, InitialSpeed = InitialSpeed, SpheresPerSecond = SpheresPerSecond, ChanceToUpgrade = ChanceToUpgrade, SpeedPerUpgrade = SpeedPerUpgrade, SpawnRatePerUpgrade = SpawnRatePerUpgrade, MinUpgradesToBurst = MinUpgradesToBurst, ChanceToBurst = ChanceToBurst, ChanceToSkipSpawnPerUpgrade = ChanceToSkipSpherePerUpgrade, MaxChanceToSkipSpawn = MaxChanceToSkipSpawn, UpgradesToSkipSpawn = UpgradesToSkipSphere, SkipSpawnDuration = SkipSpawnDuration, SecondsUntilSpawn = 0, TimesUpgraded = 0 }); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var alphaEntity = conversionSystem.GetPrimaryEntity(alpha); dstManager.AddComponentData(entity, new AlphaEntity { Value = alphaEntity }); dstManager.AddComponentData(entity, new SelectedSquareaEntity { Value = Entity.Null }); dstManager.AddComponentData(entity, new isUIHidden { Value = false }); dstManager.AddComponentData(entity, new PageIndex { Value = 1 }); dstManager.AddComponentData(entity, new SquareaGenerator { Prefab = conversionSystem.GetPrimaryEntity(squareaPrefab), RoomSize = roomSize }); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponentData(entity, new AsteroidSpawner { Prefab = conversionSystem.GetPrimaryEntity(Prefab), Rate = SpawnRate, MinSpeed = MinSpeed, MaxSpeed = MaxSpeed, PathVariation = PathVariation }); dstManager.AddComponentData(entity, new GameState { Value = GameStates.Start }); var buffer = dstManager.AddBuffer <AsteroidSprite>(entity); if (Sprites == null) { return; } foreach (var s in Sprites) { buffer.Add(new AsteroidSprite { Sprite = conversionSystem.GetPrimaryEntity(s) }); } }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var tilesRootEntity = conversionSystem.GetPrimaryEntity(TilesRoot); var spellCardsRootEntity = conversionSystem.GetPrimaryEntity(SpellCardsRoot); var elementCardsRootEntity = conversionSystem.GetPrimaryEntity(ElementCardsRoot); var actionEntity = conversionSystem.GetPrimaryEntity(ActionRoot); if (OwningPlayer == Player.Player1) { dstManager.AddComponent <Player1>(entity); } else { dstManager.AddComponent <Player2>(entity); } dstManager.AddComponentData(entity, new Hand { TilesRootEntity = tilesRootEntity, SpellCardsRootEntity = spellCardsRootEntity, ElementCardsRootEntity = elementCardsRootEntity, ActionEntity = actionEntity }); dstManager.AddBuffer <TileEntry>(tilesRootEntity); dstManager.AddBuffer <SpellCardEntry>(spellCardsRootEntity); dstManager.AddBuffer <ElementCardEntry>(elementCardsRootEntity); dstManager.AddComponentData(actionEntity, default(Action)); dstManager.AddBuffer <ElementCardEntry>(actionEntity); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponentData(entity, new PrefabRigister { Pistol = conversionSystem.GetPrimaryEntity(Pistol), Bullet = conversionSystem.GetPrimaryEntity(Bullet) }); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var buffer = dstManager.AddBuffer <RaycastableElement>(entity); if (UseCustomSequence) { int count = CustomSequence.Count; for (int i = 0; i < count; i++) { int index = RevertSequenceOrder ? count - i - 1 : i; var go = CustomSequence[index]; if (go == null) { continue; } var childEntity = conversionSystem.GetPrimaryEntity(go); buffer.Add(new RaycastableElement { Target = childEntity }); } } else { int count = transform.childCount; for (int i = 0; i < count; i++) { int index = RevertSequenceOrder ? count - i - 1 : i; var go = transform.GetChild(index); var childEntity = conversionSystem.GetPrimaryEntity(go); buffer.Add(new RaycastableElement { Target = childEntity }); } } }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var sourceEntity = conversionSystem.GetPrimaryEntity(jengapiecePrefab); if (sourceEntity == null) { return; } var boxSize = Vector3.zero; var renderer = jengapiecePrefab.GetComponent <Renderer>(); if (renderer != null) { boxSize = renderer.bounds.size; } var createJengas = new CreateJenga { jengaEntity = conversionSystem.GetPrimaryEntity(jengapiecePrefab), height = this.height, rowCount = this.rowCount, startPosition = transform.position, startRotation = transform.rotation, boxSize = boxSize }; dstManager.AddComponentData <CreateJenga>(entity, createJengas); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var buffer = dstManager.AddBuffer <LevelBuffer>(entity); foreach (var t in levels) { var levelEntity = conversionSystem.GetPrimaryEntity(t); buffer.Add(new LevelBuffer() { Entity = levelEntity }); } var bufferColor = dstManager.AddBuffer <ColorsBuffer>(entity); var colorSorted = colors.OrderBy(material => (int)material.colorsType).ToArray(); foreach (var colorMaterial in colorSorted) { var levelEntity = conversionSystem.GetPrimaryEntity(colorMaterial.material); bufferColor.Add(new ColorsBuffer { Entity = levelEntity }); } }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponent <ThirdPersonMode>(entity); dstManager.AddComponentData(entity, new PlayerMovementState { MovementSpeed = MovementSpeed, RotationSpeedY = RotationSpeedY, RTSCamerHeight = RTSCameraHeight, RTSCameraFrameWidth = RTSCameraFrameWidth, RTSCameraSpeed = RTSCameraSpeed, RotationRoot = conversionSystem.GetPrimaryEntity(RotationRoot.gameObject), FocusPoint = conversionSystem.GetPrimaryEntity(FocusPoint.gameObject), CameraPoint = conversionSystem.GetPrimaryEntity(CameraPoint.gameObject), GroundFilter = new CollisionFilter { BelongsTo = CollisionFilter.Default.BelongsTo, CollidesWith = GroundTag.Value, }, }); dstManager.AddComponentData(entity, new PlayerCamera { Camera = Camera, }); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var spawner = new Spawner { Origin = this.transform.position, EntityPrefab = conversionSystem.GetPrimaryEntity(this.EntityPrefab), EntityCount = this.EntityCount, SphereOccluderPrefab = conversionSystem.GetPrimaryEntity(this.SphereOccluderPrefab), SphereOccluderCount = this.SphereOccluderCount, QuadOccluderPrefab = conversionSystem.GetPrimaryEntity(this.QuadOccluderPrefab), QuadOccluderCount = this.QuadOccluderCount, MinGenerationSpan = this.MinGenerationSpan, MaxGenerationSpan = this.MaxGenerationSpan, MinScale = this.MinScale, MaxScale = this.MaxScale, MinSelfRotationSpeed = this.MinSelfRotationSpeed, MaxSelfRotationSpeed = this.MaxSelfRotationSpeed, MinWorldRotationSpeed = this.MinWorldRotationSpeed, MaxWorldRotationSpeed = this.MaxWorldRotationSpeed, StaticEntityPercentage = this.StaticEntityPercentage, SphereOccluderMaxGenerationSpan = this.SphereOccluderMaxGenerationSpan, SphereOccluderMaxScale = this.SphereOccluderMaxScale, SphereOccluderMinGenerationSpan = this.SphereOccluderMinGenerationSpan, SphereOccluderMinScale = this.SphereOccluderMinScale, QuadOccluderMaxGenerationSpan = this.QuadOccluderMaxGenerationSpan, QuadOccluderMaxScale = this.QuadOccluderMaxScale, QuadOccluderMinGenerationSpan = this.QuadOccluderMinGenerationSpan, QuadOccluderMinScale = this.QuadOccluderMinScale, }; dstManager.AddComponentData(entity, spawner); dstManager.AddComponent <SpawnerUnusedTag>(entity); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { if (PhysicsColliderPrefabA == null || PhysicsColliderPrefabB == null) { return; } var entityA = conversionSystem.GetPrimaryEntity(PhysicsColliderPrefabA); var entityB = conversionSystem.GetPrimaryEntity(PhysicsColliderPrefabB); if (entityA == Entity.Null || entityB == Entity.Null) { return; } var colliderA = dstManager.GetComponentData <PhysicsCollider>(entityA); var colliderB = dstManager.GetComponentData <PhysicsCollider>(entityB); dstManager.AddComponentData(entity, new ChangeColliderType() { ColliderA = colliderA, ColliderB = colliderB, EntityA = entityA, EntityB = entityB, TimeToSwap = TimeToSwap, LocalTime = TimeToSwap, }); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { Assert.IsNotNull(tip); Assert.IsNotNull(mid); Assert.IsNotNull(pin); var spatula = default(SpatulaComponent); spatula.len = len; spatula.snap = snap; spatula.deadzone = deadzone; spatula.friction = friction; spatula.bend = bend; spatula.bendPin = bendPin; spatula.tip = conversionSystem.GetPrimaryEntity(tip); spatula.mid = conversionSystem.GetPrimaryEntity(mid); spatula.pin = conversionSystem.GetPrimaryEntity(pin); spatula.joy = math.float2(0); spatula.velocity = math.float2(0); spatula.kinematic = true; dstManager.AddComponentData(entity, spatula); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var count = this.ArmCount; var spawn = new SpawnAllComponent { RockPrefab = conversionSystem.GetPrimaryEntity(this.RockPrefab), TinCanPrefab = conversionSystem.GetPrimaryEntity(this.TinCanPrefab), ArmPrefab = conversionSystem.GetPrimaryEntity(this.ArmPrefab), Count = count }; dstManager.AddComponentData(entity, spawn); float conveyorWidth = (2.0f * this.ConveyorMargin) + this.ArmCount * this.ArmWidth; var data = new ThrowingArmsSharedDataComponent { ArmCount = this.ArmCount, ArmWidth = this.ArmWidth, ConveyorMargin = this.ConveyorMargin, ConveyorWidth = conveyorWidth, ConveyorMaxX = conveyorWidth + this.ConveyorMargin, ConveyorMinX = -this.ConveyorMargin, ConveyorSpeed = this.ConveyorSpeed, }; dstManager.AddComponentData(entity, data); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { if (ActiveAtStart) { dstManager.AddComponent <ActiveVehicle>(entity); } dstManager.AddComponent <Vehicle>(entity); dstManager.AddComponentData(entity, new VehicleCameraSettings { OrientationType = CameraOrientation, OrbitAngularSpeed = math.radians(CameraOrbitAngularSpeed) }); dstManager.AddComponentData(entity, new VehicleSpeed { TopSpeed = TopSpeed, Damping = SpeedDamping }); dstManager.AddComponentData(entity, new VehicleSteering { MaxSteeringAngle = math.radians(MaxSteeringAngle), Damping = SteeringDamping }); dstManager.AddComponentData(entity, new VehicleCameraReferences { CameraOrbit = conversionSystem.GetPrimaryEntity(CameraOrbit), CameraTarget = conversionSystem.GetPrimaryEntity(CameraTarget), CameraTo = conversionSystem.GetPrimaryEntity(CameraTo), CameraFrom = conversionSystem.GetPrimaryEntity(CameraFrom) }); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponentData <NavSurface>(entity, new NavSurface { Basis = conversionSystem.GetPrimaryEntity(Basis) }); if (HasGameObjectTransform) { dstManager.AddComponent(entity, typeof(CopyTransformFromGameObject)); } else { dstManager.AddComponent(entity, typeof(CopyTransformToGameObject)); } dstManager.AddComponent(entity, typeof(NavJumpableBufferElement)); var jumpableBuffer = dstManager.GetBuffer <NavJumpableBufferElement>(entity); JumpableSurfaces.ForEach(surface => jumpableBuffer.Add(conversionSystem.GetPrimaryEntity(surface))); dstManager.AddComponent(entity, typeof(NavJumpableBufferElement)); dstManager.RemoveComponent(entity, typeof(NonUniformScale)); dstManager.RemoveComponent(entity, typeof(MeshRenderer)); dstManager.RemoveComponent(entity, typeof(RenderMesh)); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponentData(entity, new Settings { BeltDistanceSubDiv = (ushort)SubdivCount, DebugDraw = DebugDraw, }); var prefabEntity = conversionSystem.GetPrimaryEntity(BeltPrefab); var spltterPrefab = conversionSystem.GetPrimaryEntity(SplitterPrefab); var itemEntity = conversionSystem.GetPrimaryEntity(ItemPrefab); var item2Entity = conversionSystem.GetPrimaryEntity(Item2Prefab); dstManager.AddComponentData(entity, new Prefabs { BeltPrefab = prefabEntity, ItemPrefab = itemEntity, Item2Prefab = item2Entity, }); var entities = // MakeSplitter(dstManager, prefabEntity, spltterPrefab,10); MakeSplitter(dstManager, prefabEntity, spltterPrefab, 100_000); // Make3BeltsU(dstManager, prefabEntity, 2, 2); // Make3BeltsU(dstManager, prefabEntity, 100, 100000); // MakeT(dstManager, prefabEntity); // MakeT2(dstManager, prefabEntity); entities.Dispose(); }
protected PhysicsConstrainedBodyPair GetConstrainedBodyPair(GameObjectConversionSystem conversionSystem) { return(new PhysicsConstrainedBodyPair( conversionSystem.GetPrimaryEntity(this), ConnectedBody == null ? Entity.Null : conversionSystem.GetPrimaryEntity(ConnectedBody), EnableCollision )); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { red = conversionSystem.GetPrimaryEntity(redPrefab); green = conversionSystem.GetPrimaryEntity(greenPrefab); pink = conversionSystem.GetPrimaryEntity(pinkPrefab); blue = conversionSystem.GetPrimaryEntity(bluePrefab); heavy = conversionSystem.GetPrimaryEntity(heavyPrefab); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponentData(entity, new PrefabReferences() { carSmokePrefab = conversionSystem.GetPrimaryEntity(CarSmokePrefabMeshRenderer), carSmokeDestroyedPrefab = conversionSystem.GetPrimaryEntity(CarSmokeDestroyedPrefabMeshRenderer) }); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponentData(entity, new BattleConfigData { prefabRed = conversionSystem.GetPrimaryEntity(prefabRed), prefabBlue = conversionSystem.GetPrimaryEntity(prefabBlue) }); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponentData(entity, new HeartManager() { HeartPrefab = conversionSystem.GetPrimaryEntity(HeartPrefab), HeartBackgroundPrefab = conversionSystem.GetPrimaryEntity(HeartBackgroundPrefab), NoOfHearts = NoOfHearts }); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { dstManager.AddComponentData(entity, new EntitySpawnInfoComponent(ref entitySpawn) { preset = conversionSystem.GetPrimaryEntity(spawnPreset), spawnEffect = conversionSystem.GetPrimaryEntity(spawnEffectPreset), destroyEffect = conversionSystem.GetPrimaryEntity(destroyEffectPreset), }); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var spawnerData = new SpawnerGardenEntity { prefabEarth = conversionSystem.GetPrimaryEntity(prefabEarth), prefabFollowJuice = conversionSystem.GetPrimaryEntity(prefabFollowJuice), }; dstManager.AddComponentData(entity, spawnerData); }