Beispiel #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;
        }
Beispiel #2
0
    public static JobHandle Schedule(ref AnchoredTransitionTask transition)
    {
        var job = new AnchoredTransitionJob()
        {
            anchoredTransition = MemoryRef <AnchoredTransitionTask> .Create(ref transition)
        };

        return(job.Schedule());
    }
Beispiel #3
0
    public override void OnEnable()
    {
        base.OnEnable();

        kinematica = GetComponent <Kinematica>();

        state         = State.Suspended;
        previousState = State.Suspended;

        climbingState              = ClimbingState.Idle;
        previousClimbingState      = ClimbingState.Idle;
        lastCollidingClimbingState = ClimbingState.None;

        clothComponents = GetComponentsInChildren <Cloth>();

        ledgeGeometry = LedgeGeometry.Create();
        wallGeometry  = WallGeometry.Create();

        ledgeAnchor = LedgeAnchor.Create();
        wallAnchor  = WallAnchor.Create();

        anchoredTransition = AnchoredTransitionTask.Invalid;
    }
Beispiel #4
0
    public override void OnEnable()
    {
        base.OnEnable();

        anchoredTransition = AnchoredTransitionTask.Invalid;
    }