예제 #1
0
    public Ability OnUpdate(float deltaTime)
    {
        bool active = anchoredTransition.isValid;

        var controller = GetComponent <MovementController>();

        controller.collisionEnabled         = !active;
        controller.groundSnap               = !active;
        controller.resolveGroundPenetration = !active;
        controller.gravityEnabled           = !active;

        if (active)
        {
            var kinematica = GetComponent <Kinematica>();

            ref var synthesizer = ref kinematica.Synthesizer.Ref;

            if (!anchoredTransition.IsState(AnchoredTransitionTask.State.Complete) && !anchoredTransition.IsState(AnchoredTransitionTask.State.Failed))
            {
                anchoredTransition.synthesizer = MemoryRef <MotionSynthesizer> .Create(ref synthesizer);

                kinematica.AddJobDependency(AnchoredTransitionJob.Schedule(ref anchoredTransition));

                return(this);
            }

            anchoredTransition.Dispose();
            anchoredTransition = AnchoredTransitionTask.Invalid;
        }
예제 #2
0
    public static JobHandle Schedule(ref AnchoredTransitionTask transition)
    {
        var job = new AnchoredTransitionJob()
        {
            anchoredTransition = MemoryRef <AnchoredTransitionTask> .Create(ref transition)
        };

        return(job.Schedule());
    }