private void TestPhysics() { var mesh = Actor.GetComponent <StaticMeshComponent>(); mesh.SimulatePhysics = true; mesh.IsGravityEnabled = true; //mesh.LocalPosition Vector socket = mesh.GetSocketLocation("Socket"); Vector impluse = new Vector(0.0f, 0.0f, 10000000.0f); /* Impluse * mesh.AddImpulse(impluse); * mesh.AddImpulseAtLocation(impluse, socket); * mesh.AddRadialImpulse(socket, 100000.0f, 100000.0f, RadialImpulseFalloff.MAX); */ mesh.AddForceAtLocation(impluse, socket); //mesh.AddRadialForce(socket, 1000000.0f, 1000000.0f, RadialImpulseFalloff.MAX); //mesh.AddTorque(impluse); TimerTest.DelayInvoke(1.0f, () => { Vector velocity = Vector.ZeroVector; //velocity = mesh.GetPhysicsLinearVelocity(); //velocity = mesh.GetPhysicsAngularVelocity(); //velocity = mesh.GetPhysicsLinearVelocityAtPoint(socket); //Log.Error("[PhysiscTest] get velocity:" + velocity); velocity = new Vector(0.0f, -1000000.0f, -100000.0f); mesh.SetPhysicsLinearVelocity(velocity); }); }
private void TestBPAnimation() { TimerTest.DelayInvoke(2, () => { this.SendEvent("SetHorseWoman", 1); TimerTest.DelayInvoke(5, () => { this.SendEvent("SetHorseWoman", 2); }); }); }
private void TestUI() { TimerTest.DelayInvoke(2, () => { this.SendEvent("SetTitle", "奇境森林"); }); TimerTest.DelayInvoke(4, () => { this.SendEvent("SetContent", "UIContent:奇境森林\r\n奇境森林\r\n奇境森林\r\n奇境森林\r\n奇境森林"); }); }
private void TestSimpleAnimation() { TimerTest.DelayInvoke(2, () => { this.SendEvent("Play"); TimerTest.DelayInvoke(5, () => { this.SendEvent("Pause"); }); }); }
/// <summary> /// 测试加载关卡 /// </summary> private void TestLoadLevel() { Log.Error("[WorldTest] CurrentLevelName:" + World.GetCurrentLevel()); //要加载的窗口必须 窗口->关卡 菜单中注册 World.LoadStreamingLevel("SubMain"); TimerTest.DelayInvoke(5, () => { TestUnLoadLevel(); }); }
/// <summary> /// 测试动态加载蓝图,路径以/开头表示根目录,然后输入文件的全路径 /// </summary> private void TestSpawnActor() { var trans = new Transform(); var actor = World.SpwanActor("Resources/Blueprints/Actor3_blueprint", ref trans); var cube = actor.GetComponentByTag <StaticMeshComponent>("Cube"); if (cube == null) { Log.Error("[WorldTest] cube is null"); } else { cube.Visible = true; cube.Activited = false; } var sphere = actor.GetComponentByTag <StaticMeshComponent>("Sphere"); if (sphere == null) { Log.Error("[WorldTest] sphere is null"); } else { sphere.Visible = true; sphere.Activited = false; } actor.Root.LocalPosition = new Vector(1000, 1000, 1000); actor.Root.LocalScale = new Vector(5, 5, 5); var seq = actor.Sequencer; if (seq == null) { Log.Error("[WorldTest] Sequencer is null"); } else { Log.Error("[WorldTest] Sequencer name:" + seq.GetType()); } var init = actor.GetMonoComponent() as InitTest; init.Activited = false; //测试初始化组件值,会在initialize之后调用,beginplay之前调用 init.TestValue = 100; init.SendEvent("TestEventInt", 1881); init.SendEvent("TestEventString", "string"); //actor.Destroy(); TimerTest.DelayInvoke(1.0f, () => { init.SendEvent("TestEventString", "timerstring"); }); }
private void TestMovement() { if (Pawn == null) { Log.Error("[MovementTest] MyPawn is null"); } else { Controller con = Pawn.Controller; if (con == null) { Log.Error("[MovementTest] ai is null"); } else { TimerTest.DelayInvoke(5, () => { con.SimpleMoveToLocation(new Vector(1000.0f, 0, 0)); }); } } }
private void TestParticleSystem() { var particles = Actor.GetComponent <ParticleSystemComponent>(); if (particles == null) { Log.Error("[ParticleTest] particle is null"); } particles.RegParticleBurst(this); particles.RegParticleCollide(this); particles.RegParticleDeath(this); particles.RegParticleSpawn(this); particles.RegSystemFinished(this); particles.ActivateSystem(); TimerTest.DelayInvoke(5.0f, () => { particles.DeactivateSystem(); TimerTest.DelayInvoke(3.0f, () => { particles.ActivateSystem(); }); }); }