Beispiel #1
0
    private void Start()
    {
        var settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, blob);

        var playerQuery    = manager.CreateEntityQuery(ComponentType.ReadOnly <PlayerShipData>());
        var playerEntities = playerQuery.ToEntityArray(Unity.Collections.Allocator.TempJob);
        var playerEntity   = playerEntities[0];

        DataManager.instance.playerEntity = playerEntity;
        tracker.SetReceivedEntity(playerEntity);
        fovController.SetReceivedEntity(playerEntity);

        var bulletEntity        = GameObjectConversionUtility.ConvertGameObjectHierarchy(bulletPrefab, settings);
        var triggerbulletEntity = GameObjectConversionUtility.ConvertGameObjectHierarchy(rocketPrafeb, settings);
        var playerData          = manager.GetComponentData <PlayerShipData>(playerEntity);

        playerData.bulletEntityPrefab        = bulletEntity;
        playerData.triggerBulletEntityPrefab = triggerbulletEntity;
        manager.SetComponentData(playerEntity, playerData);


        playerEntities.Dispose();
    }