Esempio n. 1
0
        public static void OnBeginPlay()
        {
            Debug.Log(LogLevel.Display, "Hello, Unreal Engine!");
            Debug.AddOnScreenMessage(-1, 3.0f, Color.LightGreen, MethodBase.GetCurrentMethod().DeclaringType + " system started!");

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

            Actor kachujin = new Actor("Kachujin");
            SkeletalMeshComponent kachujinSkeletalMeshComponent = new SkeletalMeshComponent(kachujin);
            SkeletalMesh          kachujinSkeletalMesh          = SkeletalMesh.Load("/Game/Tests/Characters/Kachujin/SkeletalMesh");

            kachujinSkeletalMeshComponent.SetSkeletalMesh(kachujinSkeletalMesh);
            kachujinSkeletalMeshComponent.SetWorldLocation(new Vector3(-70.0f, -100.0f, -700.0f));
            kachujinSkeletalMeshComponent.SetWorldRotation(Maths.Euler(0.0f, 90.0f, 0.0f));
            kachujinSkeletalMeshComponent.SetAnimationMode(AnimationMode.Asset);
            kachujinSkeletalMeshComponent.PlayAnimation(AnimationSequence.Load("/Game/Tests/Characters/Kachujin/AnimationSequenceSwordSwing"), true);

            Actor ganfault = new Actor("Ganfault");
            SkeletalMeshComponent ganfaultSkeletalMeshComponent = new SkeletalMeshComponent(ganfault);
            SkeletalMesh          ganfaultSkeletalMesh          = SkeletalMesh.Load("/Game/Tests/Characters/Ganfault/SkeletalMesh");

            ganfaultSkeletalMeshComponent.SetSkeletalMesh(ganfaultSkeletalMesh);
            ganfaultSkeletalMeshComponent.SetWorldLocation(new Vector3(70.0f, -100.0f, -700.0f));
            ganfaultSkeletalMeshComponent.SetWorldRotation(Maths.Euler(0.0f, 90.0f, 0.0f));
            ganfaultSkeletalMeshComponent.SetAnimationMode(AnimationMode.Asset);
            ganfaultSkeletalMeshComponent.PlayAnimation(AnimationMontage.Load("/Game/Tests/Characters/Ganfault/AnimationMontage"), true);
        }
Esempio n. 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");
        }