Пример #1
0
    // The MonoBehaviour data is converted to ComponentData on the entity.
    // We are specifically transforming from a good editor representation of the data (Represented in degrees)
    // To a good runtime representation (Represented in radians)
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var data = new RotationSpeed_IJobEntityBatch {
            RadiansPerSecond = math.radians(DegreesPerSecond)
        };

        dstManager.AddComponentData(entity, data);
    }
Пример #2
0
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var rotationSpeedSetting = conversionSystem.GetBuildConfigurationComponent <RotationSpeedSetting>();

        // Change rotation speed
        var data = new RotationSpeed_IJobEntityBatch {
            RadiansPerSecond = math.radians(rotationSpeedSetting.RotationSpeed)
        };

        dstManager.AddComponentData(entity, data);

        // Offset the translation of the generated object
        var translation = dstManager.GetComponentData <Translation>(entity);

        translation.Value.y += rotationSpeedSetting.Offset;
        dstManager.SetComponentData(entity, translation);
    }