public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext)
        {
            await base.ExecuteAsync(context, branchContext);

            MovementType = (MovementType)context.Reader.Read <uint>();

            switch (MovementType)
            {
            case MovementType.Ground:
                await GroundBehavior.ExecuteAsync(context, branchContext);

                return;

            case MovementType.Jump:
                await JumpBehavior.ExecuteAsync(context, branchContext);

                return;

            case MovementType.Falling:
                await FallingBehavior.ExecuteAsync(context, branchContext);

                return;

            case MovementType.DoubleJump:
                await DoubleJumpBehavior.ExecuteAsync(context, branchContext);

                return;

            case MovementType.Jetpack:
                await JetpackBehavior.ExecuteAsync(context, branchContext);

                return;

            case MovementType.Stunned:
                return;

            default:
                throw new Exception($"Invalid {nameof(MovementType)}! Got {MovementType}!");
            }
        }
예제 #2
0
        public override async Task ExecuteAsync(ExecutionContext context, ExecutionBranchContext branchContext)
        {
            await base.ExecuteAsync(context, branchContext);

            MovementType = (MovementType)context.Reader.Read <uint>();

            context.Writer.Write((uint)MovementType);

            switch (MovementType)
            {
            case MovementType.Ground:
                await GroundBehavior.ExecuteAsync(context, branchContext);

                return;

            case MovementType.Jump:
                await JumpBehavior.ExecuteAsync(context, branchContext);

                return;

            case MovementType.Falling:
                await FallingBehavior.ExecuteAsync(context, branchContext);

                return;

            case MovementType.DoubleJump:
                await DoubleJumpBehavior.ExecuteAsync(context, branchContext);

                return;

            case MovementType.Jetpack:
                await JetpackBehavior.ExecuteAsync(context, branchContext);

                return;

            default:
                return;
            }
        }