Basic fighting system

This commit is contained in:
cblech
2025-07-10 03:38:48 +02:00
parent 7e6163ed68
commit b6fd6292e3
26 changed files with 3065 additions and 8 deletions
+27
View File
@@ -0,0 +1,27 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Xml.Schema;
namespace Babushka.scripts.CSharp.Common.Util;
public static class LinqExtras
{
public static void ForEach<T>(this IEnumerable<T> self, Action<T> action)
{
foreach (var t in self)
{
action.Invoke(t);
}
}
public static T? Random<T>(this IEnumerable<T> self)
{
var selfList = self.ToList();
if (selfList.Count == 0) return default;
if (selfList.Count == 1) return selfList[0];
var randomIndex = new Random().Next(0, selfList.Count);
return selfList[randomIndex];
}
}