Пример #1
0
 public BlueprintsExtensibility()
 {
     blueprintActor          = Blueprint.Load("/Game/Tests/BlueprintActor");
     blueprintSceneComponent = Blueprint.Load("/Game/Tests/BlueprintSceneComponent");
     actor                 = new Actor(blueprint: blueprintActor);
     sceneComponent        = new SceneComponent(actor, blueprint: blueprintSceneComponent);
     levelScript           = World.GetActor <LevelScript>();
     skeletalMeshComponent = actor.GetComponent <SkeletalMeshComponent>();
     animationInstance     = skeletalMeshComponent.GetAnimationInstance();
 }
Пример #2
0
        public static void OnBeginPlay()
        {
            Debug.AddOnScreenMessage(-1, 3.0f, Color.LightGreen, MethodBase.GetCurrentMethod().DeclaringType + " system started!");

            World.GetFirstPlayerController().SetViewTarget(World.GetActor <Camera>("MainCamera"));

            SkeletalMesh prototypeMesh = SkeletalMesh.Load("/Game/Tests/Characters/Prototype");

            Actor leftPrototype = new Actor("leftPrototype");
            SkeletalMeshComponent leftSkeletalMeshComponent = new SkeletalMeshComponent(leftPrototype);

            leftSkeletalMeshComponent.SetSkeletalMesh(prototypeMesh);
            leftSkeletalMeshComponent.SetWorldLocation(new Vector3(-700.0f, -70.0f, -100.0f));
            leftSkeletalMeshComponent.SetWorldRotation(Maths.Euler(0.0f, 0.0f, 90.0f));
            leftSkeletalMeshComponent.SetAnimationMode(AnimationMode.Asset);
            leftSkeletalMeshComponent.PlayAnimation(AnimationSequence.Load("/Game/Tests/Characters/Animations/IdleAnimationSequence"), true);

            Assert.IsTrue(leftSkeletalMeshComponent.IsPlaying);
            Assert.IsTrue(leftSkeletalMeshComponent.GetBoneName(0) == "root");

            Actor rightPrototype = new Actor("rightPrototype");
            SkeletalMeshComponent rightSkeletalMeshComponent = new SkeletalMeshComponent(rightPrototype);

            rightSkeletalMeshComponent.SetSkeletalMesh(prototypeMesh);
            rightSkeletalMeshComponent.SetWorldLocation(new Vector3(-700.0f, 70.0f, -100.0f));
            rightSkeletalMeshComponent.SetWorldRotation(Maths.Euler(0.0f, 0.0f, 90.0f));
            rightSkeletalMeshComponent.SetAnimationMode(AnimationMode.Asset);
            rightSkeletalMeshComponent.CreateAndSetMaterialInstanceDynamic(0).SetVectorParameterValue("AccentColor", new LinearColor(0.0f, 0.5f, 1.0f));

            AnimationMontage rightPrototypeAnimationMontage = AnimationMontage.Load("/Game/Tests/Characters/Animations/RunAnimationMontage");

            rightSkeletalMeshComponent.PlayAnimation(rightPrototypeAnimationMontage, true);

            AnimationInstance rightPrototypeAnimationInstance = rightSkeletalMeshComponent.GetAnimationInstance();

            Assert.IsTrue(rightPrototypeAnimationInstance.IsPlaying(rightPrototypeAnimationMontage));
            Assert.IsTrue(rightSkeletalMeshComponent.GetBoneName(0) == "root");
        }