public override void _Process(float delta) { _cursorRoot.GlobalPosition = _cursorRoot.GetGlobalMousePosition(); if (Input.IsActionJustPressed("main_attack")) { _animationPlayer.Stop(); _animationPlayer.Play(ANIM_DEFAULT); } }
public override void _Process(float delta) { base._Process(delta); string[] actions = { "select_prisoner", "open_context_menu", "select_multiple_prisoners" }; GameplayIntent[] intents = { GameplayIntent.PrimaryAction, GameplayIntent.SecondaryAction, GameplayIntent.MultipleSelect }; for (int i = 0; i < 3; ++i) { if (Input.IsActionJustPressed(actions[i])) { PlayerIntent <GameplayIntent> intent = new PlayerIntent <GameplayIntent>( intents[i], PlayerIntent <GameplayIntent> .ActionType.Pressed, new Dictionary <GameplayIntent, bool> { { GameplayIntent.PrimaryAction, Input.IsActionPressed("select_prisoner") }, { GameplayIntent.SecondaryAction, Input.IsActionPressed("open_context_menu") }, { GameplayIntent.MultipleSelect, Input.IsActionPressed("select_multiple_prisoners") } } ); if (IntentList.ResolveIntent(intent)) { break; } if (Input.IsActionJustPressed("select_prisoner")) { if (Input.IsActionPressed("select_multiple_prisoners")) { SelectAdditionalPrisoners(HoveredPrisoners); } else { if (HoveredPrisoners.Count != 0) { SelectSinglePrisoner(HoveredPrisoners[0]); } else { DeselectAllprisoners(); } } ContextMenu.Visible = false; } if (Input.IsActionJustPressed("open_context_menu")) { ContextMenu.Visible = true; ContextMenuPosition.Position = LevelRoot.GetGlobalMousePosition(); ContextMenu.SetItems(new List <ContextMenu.Item> { new ContextMenu.Item("Guard Area", () => { GD.Print("Guarding Area..."); }), new ContextMenu.Item("Hide Contraband", () => { GD.Print("Hiding Contraband..."); }), new ContextMenu.Item("Dig Tunnel", () => { GD.Print("Digging Tunnel..."); }) }); } } } }
public override void _Process(float delta) { _node2d.GlobalPosition = _node2d.GetGlobalMousePosition(); }