add: Selectable Tile Map Layer/Mouse Controlled Camera
This commit is contained in:
12
src/Extensions/LinqExtensions.cs
Normal file
12
src/Extensions/LinqExtensions.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Godot;
|
||||
|
||||
namespace Polonium.Extensions;
|
||||
|
||||
public static class LinqExtensions
|
||||
{
|
||||
public static T RandomSelect<T>(this IEnumerable<T> source)
|
||||
{
|
||||
T[] s = source.ToArray();
|
||||
return s[GD.Randi() % s.Length];
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,13 @@ public static class Utils
|
||||
{
|
||||
if (!fname.EndsWith(".png"))
|
||||
continue;
|
||||
AnimatedTextureCache[path].SetFrameTexture(f, ResourceLoader.Load<Texture2D>(fname));
|
||||
AnimatedTextureCache[path].SetFrameTexture(f, ResourceLoader.Load<Texture2D>($"{path}/{fname}"));
|
||||
f += 1;
|
||||
}
|
||||
|
||||
AnimatedTextureCache[path].SetFrames(f + 1);
|
||||
AnimatedTextureCache[path].SetOneShot(false);
|
||||
AnimatedTextureCache[path].SetSpeedScale(4);
|
||||
}
|
||||
|
||||
return AnimatedTextureCache[path];
|
||||
@@ -44,6 +49,7 @@ public static class Utils
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#pragma warning restore CS0618
|
||||
#pragma warning restore CS0168
|
||||
Reference in New Issue
Block a user