Newer
Older
DungeonShooting / DungeonShooting_Godot / src / test / TestCreateSector.cs
@小李xl 小李xl on 11 Oct 2023 603 bytes 日志系统
  1. using Godot;
  2. using System;
  3.  
  4. public partial class TestCreateSector : Node2D
  5. {
  6.  
  7. private CollisionPolygon2D _polygon2D;
  8. public override void _Ready()
  9. {
  10. GetNode<Area2D>("Area2D").AreaEntered += area =>
  11. {
  12. Debug.Log("areaEnter: " + area.Name);
  13. };
  14. _polygon2D = GetNode<CollisionPolygon2D>("Area2D/CollisionPolygon2D");
  15. _polygon2D.Polygon = Utils.CreateSectorPolygon(90, 350, 160, 10);
  16. }
  17.  
  18. public override void _Process(double delta)
  19. {
  20. GetNode<Area2D>("Area2D2").GlobalPosition = GetGlobalMousePosition();
  21. }
  22. }