Ejemplo n.º 1
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            NativeArray <CharaPos>     charaPoses     = m_query.ToComponentDataArray <CharaPos>(Allocator.TempJob);
            NativeArray <CharaLastPos> charaLastPoses = m_query.ToComponentDataArray <CharaLastPos>(Allocator.TempJob);
            NativeArray <CharaQueue>   charaQueues    = m_query.ToComponentDataArray <CharaQueue>(Allocator.TempJob);
            NativeArray <CharaFlag>    charaFlags     = m_query.ToComponentDataArray <CharaFlag>(Allocator.TempJob);

            NativeMapTips mapTips = Shared.m_mapTipList.m_MapTipList[0];
            var           job     = new MapJob()
            {
                m_charaPoses     = charaPoses,
                m_charaLastPoses = charaLastPoses,
                m_charaQueues    = charaQueues,
                m_charaFlags     = charaFlags,
                MapSizeX         = mapTips.m_mapSizeX,
                MapSizeY         = mapTips.m_mapSizeY,
                MapSizeZ         = mapTips.m_mapSizeZ,
                Shapes           = mapTips.shapes,
                Events           = mapTips.events,
            };

            inputDeps = job.Schedule(inputDeps);
            inputDeps.Complete();

            m_query.CopyFromComponentDataArray(job.m_charaQueues);
            m_query.CopyFromComponentDataArray(job.m_charaPoses);

            charaFlags.Dispose();
            charaQueues.Dispose();
            charaPoses.Dispose();
            charaLastPoses.Dispose();

            return(inputDeps);
        }
Ejemplo n.º 2
0
    public IEnumerator Generate()
    {
        if (loadFromResources)
        {
            LoadFromResources();
            transform.position = new Vector3(0, -height * 0.5f * MapController.instance.squareSize);
            yield break;
        }

        solidMap = new int[width, height];
        fluidMap = new int[width, height];

        transform.position = new Vector3(0, -height * 0.5f * MapController.instance.squareSize);

        RandomFillMap();

        MapJob mapJob = new MapJob();

        mapJob.smoothLevels = smoothing;
        mapJob.map          = solidMap;
        mapJob.Start();

        yield return(StartCoroutine(mapJob.WaitFor()));

        if (processRegions)
        {
            ProcessRegions();
        }
        if (processBorder)
        {
            ProcessBorder();
        }
        RandomFillSolidMaterial();
        RandomFillFluidMaterial();
    }
Ejemplo n.º 3
0
        public override LambdaExpression CreateProjectionFunction(MapJob job)
        {
            Reset();
            var previousJob = CurrentJob;

            job.IsProjecting = true;
            CurrentJob       = job;

            DetermineAssignments();

            var bindings = job.GetBindings();

            var ctor = Expression.MemberInit(Expression.New(job.Output), bindings);

            CurrentJob = previousJob;
            return(Expression.Lambda(ctor, job.InputParameter));
        }
Ejemplo n.º 4
0
        private Expression Project(Expression input, Expression output)
        {
            var job = new MapJob(_inputArg, _outputArg);

            var fn   = _provider.CreateProjectionFunction(job);
            var type = input.Type.IsQueryable() ? typeof(Queryable) : typeof(Enumerable);
            var expr = Expression.Call(type, "Select", new[] { fn.Parameters[0].Type, fn.ReturnType }, input, fn);

            if (expr.Type == output.Type)
            {
                return(expr);
            }

            if (output.Type.IsArray)
            {
                return(Expression.Call(type, "ToArray", new[] { _outputArg }, expr));
            }

            return(Expression.Call(type, "ToList", new[] { _outputArg }, expr));
        }
Ejemplo n.º 5
0
        public override LambdaExpression CreateMapFunction(MapJob job)
        {
            Reset();

            CurrentJob = job;
            DetermineTracking(job.Input);

            LambdaExpression plan;

            if (job.Input.IsEnumerable() && job.Output.IsEnumerable())
            {
                plan = CollectionMap();
            }
            else
            {
                plan = ClassMap();
            }

            ExpressionReady?.Invoke(this, plan);
            CurrentJob = null;

            return(plan);
        }
Ejemplo n.º 6
0
 public abstract LambdaExpression CreateProjectionFunction(MapJob job);
Ejemplo n.º 7
0
 public abstract LambdaExpression CreateMapFunction(MapJob job);