using System.Collections; using System.Collections.Generic; using System.Reflection; using Godot; using Godot.Collections; public partial class Common { public partial class RayCast { public static PhysicsDirectSpaceState2D world; public Vector2 pos; public Node obj; public Shape2D shape; } public static IEnumerator Move(Node2D obj, Vector2 pos, float frameTime, bool local = false, Vector2? start = null) { start.GetValueOrDefault(); if (!start.HasValue) { Vector2 value = (local ? obj.Position : obj.GlobalPosition); start = value; } for (float a = 0f; a < frameTime; a += Main.deltaTime) { if (local) { obj.Position = start.Value.Lerp(pos, a / frameTime); } else { obj.GlobalPosition = start.Value.Lerp(pos, a / frameTime); } yield return null; } if (local) { obj.Position = pos; } else { obj.GlobalPosition = pos; } } public static Vector2[] PosFromNode(in IList list) { Vector2[] array = new Vector2[list.Count]; for (int i = 0; i < array.Length; i++) { array[i] = list[i].GlobalPosition; } return array; } public static void FillArray(ref List array, in int max, in int start = 0) { array.Clear(); for (int i = start; i < max; i++) { array.Add(i); } } public static void SwapType(ref BaseClass en, in string subFolder = "", bool callReady = false) where BaseClass : Node where TargetClass : BaseClass { FieldInfo[] fields = typeof(BaseClass).GetFields(); object[] array = new object[fields.Length]; for (int i = 0; i < fields.Length; i++) { array[i] = fields[i].GetValue(en); } ulong instanceId = en.GetInstanceId(); en.SetScript(GD.Load