本文整理汇总了C#中Urho.Node.RunActionsAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Node.RunActionsAsync方法的具体用法?C# Node.RunActionsAsync怎么用?C# Node.RunActionsAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Urho.Node
的用法示例。
在下文中一共展示了Node.RunActionsAsync方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
protected override async void Init()
{
var cache = Application.ResourceCache;
var node = Node;
var model = node.CreateComponent<StaticModel>();
model.Model = cache.GetModel(Assets.Models.Player);
var material = cache.GetMaterial(Assets.Materials.Player).Clone("");
model.SetMaterial(material);
node.SetScale(0.45f);
node.Position = new Vector3(0f, -6f, 0f);
node.Rotation = new Quaternion(-40, 0, 0);
//TODO: rotor should be defined in the model + animation
rotor = node.CreateChild();
var rotorModel = rotor.CreateComponent<StaticModel>();
rotorModel.Model = cache.GetModel(Assets.Models.Box);
rotorModel.SetMaterial(cache.GetMaterial(Assets.Materials.Black));
rotor.Scale = new Vector3(0.1f, 1.4f, 0.1f);
rotor.Rotation = new Quaternion(0, 0, 0);
rotor.Position = new Vector3(0, -0.15f, 1.2f);
rotor.RunActionsAsync(new RepeatForever(new RotateBy(1f, 0, 0, 360f * 4))); //RPM
// Load weapons
node.AddComponent(new MachineGun());
node.AddComponent(new Missile());
await node.RunActionsAsync(new EaseOut(new MoveBy(0.5f, new Vector3(0, 3, 0)), 2));
MoveRandomly();
}
示例2: Launch
async void Launch(Node bulletNode)
{
await bulletNode.RunActionsAsync(
new MoveTo(3f, new Vector3(RandomHelper.NextRandom(-6f, 6f), -6, 0)),
new CallFunc(() => bulletNode.SetScale(0f)));
//remove the bullet from the scene.
bulletNode.Remove();
}
示例3: OnAttachedToNode
public override void OnAttachedToNode(Node node)
{
base.OnAttachedToNode(node);
Application.Input.TouchEnd += Input_TouchEnd;
Application.Input.TouchBegin += Input_TouchBegin;
cubeNode = node.CreateChild();
cubeNode.Position = new Vector3(1000, 1000, 1000);
cubeNode.SetScale(0.02f);
var box = cubeNode.CreateComponent<Box>();
box.Color = Color.White;
var moveAction = new MoveBy(0.5f, new Vector3(0, 0.005f, 0));
cubeNode.RunActionsAsync(new RepeatForever(new RotateBy(1f, 0, 120, 0)));
cubeNode.RunActionsAsync(new RepeatForever(moveAction, moveAction.Reverse()));
camera = Scene.GetChildrenWithComponent<Camera>(true).First().GetComponent<Camera>();
octree = Scene.GetComponent<Octree>(true);
}
示例4: ShowStartMenu
public async Task ShowStartMenu()
{
var cache = Application.ResourceCache;
bigAircraft = Node.CreateChild();
var model = bigAircraft.CreateComponent<StaticModel>();
model.Model = cache.GetModel(Assets.Models.Player);
model.SetMaterial(cache.GetMaterial(Assets.Materials.Player).Clone(""));
bigAircraft.SetScale(1.2f);
bigAircraft.Rotate(new Quaternion(0, 220, 40), TransformSpace.Local);
bigAircraft.Position = new Vector3(10, 2, 10);
bigAircraft.RunActionsAsync(new RepeatForever(new Sequence(new RotateBy(1f, 0f, 0f, 5f), new RotateBy(1f, 0f, 0f, -5f))));
//TODO: rotor should be defined in the model + animation
rotor = bigAircraft.CreateChild();
var rotorModel = rotor.CreateComponent<StaticModel>();
rotorModel.Model = cache.GetModel(Assets.Models.Box);
rotorModel.SetMaterial(cache.GetMaterial(Assets.Materials.Black));
rotor.Scale = new Vector3(0.1f, 1.6f, 0.1f);
rotor.Rotation = new Quaternion(0, 0, 0);
rotor.Position = new Vector3(0, -0.15f, 1);
rotor.RunActionsAsync(new RepeatForever(new RotateBy(1f, 0, 0, 360f * 3))); //RPM
menuLight = bigAircraft.CreateChild();
menuLight.Position = new Vector3(-3, 6, 2);
menuLight.AddComponent(new Light { LightType = LightType.Point, Range = 14, Brightness = 1f });
await bigAircraft.RunActionsAsync(new EaseIn(new MoveBy(1f, new Vector3(-10, -2, -10)), 2));
textBlock = new Text();
textBlock.HorizontalAlignment = HorizontalAlignment.Center;
textBlock.VerticalAlignment = VerticalAlignment.Bottom;
textBlock.Value = "TAP TO START";
textBlock.SetFont(cache.GetFont(Assets.Fonts.Font), Application.Graphics.Width / 15);
Application.UI.Root.AddChild(textBlock);
menuTaskSource = new TaskCompletionSource<bool>();
finished = false;
await menuTaskSource.Task;
}
示例5: CreateScene
async void CreateScene ()
{
Input.SubscribeToTouchEnd(OnTouched);
var cache = ResourceCache;
scene = new Scene ();
octree = scene.CreateComponent<Octree> ();
plotNode = scene.CreateChild();
var baseNode = plotNode.CreateChild().CreateChild();
var plane = baseNode.CreateComponent<StaticModel>();
plane.Model = ResourceCache.GetModel("Models/Plane.mdl");
var cameraNode = scene.CreateChild ("camera");
camera = cameraNode.CreateComponent<Camera>();
cameraNode.Position = new Vector3(10, 15, 10) / 1.75f;
cameraNode.Rotation = new Quaternion(-0.121f, 0.878f, -0.305f, -0.35f);
Node lightNode = cameraNode.CreateChild(name: "light");
var light = lightNode.CreateComponent<Light>();
light.LightType = LightType.Point;
light.Range = 100;
light.Brightness = 1.3f;
int size = 3;
baseNode.Scale = new Vector3(size * 1.5f, 1, size * 1.5f);
bars = new List<Bar>(size * size);
for (var i = 0f; i < size * 1.5f; i += 1.5f)
{
for (var j = 0f; j < size * 1.5f; j += 1.5f)
{
var boxNode = plotNode.CreateChild();
boxNode.Position = new Vector3(size / 2f - i, 0, size / 2f - j);
var box = new Bar(new Color(RandomHelper.NextRandom(), RandomHelper.NextRandom(), RandomHelper.NextRandom(), 0.9f));
boxNode.AddComponent(box);
box.SetValueWithAnimation((Math.Abs(i) + Math.Abs(j) + 1) / 2f);
bars.Add(box);
}
}
SelectedBar = bars.First();
SelectedBar.Select();
await plotNode.RunActionsAsync(new EaseBackOut(new RotateBy(2f, 0, 360, 0)));
movementsEnabled = true;
}