Eigene Kampfstile je Gegner (Faustkampf, Axt-Champions), schnelleres Laden

Stand von main 975b62f0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 14:20:38 +01:00
parent e29db47b20
commit 35a5ac5032
10 changed files with 225 additions and 30 deletions

View File

@@ -28,7 +28,9 @@ namespace GladiatorIdle.Arena
void InitModel(int color)
{
var sw = System.Diagnostics.Stopwatch.StartNew();
_model = Model3D.Load(_art);
double tLoad = sw.Elapsed.TotalMilliseconds;
bool own = _model != null;
foreach (var alt in Fallbacks(_art)) _model ??= Model3D.Load(alt);
_model ??= Model3D.Load(DefaultModel);
@@ -36,12 +38,18 @@ namespace GladiatorIdle.Arena
if (!own && _model != null && DarkSkin.Contains(_art)) _model.SetSkin(1);
else if (!own && _model != null && _art.StartsWith("hero_") && _art.EndsWith("_3")) _model.SetSkin(-1); // Vorlage 3: helle Haut
if (_model == null || _model.Clips.Count == 0) { _model = null; return; }
double tSkin = sw.Elapsed.TotalMilliseconds;
_model.Arm(_art);
double tArm = sw.Elapsed.TotalMilliseconds;
_model.SetColor(color);
var idle = Clip3("idle");
_model.Pose(idle, 0, true);
_fit = _model.FitNow();
double tColor = sw.Elapsed.TotalMilliseconds;
// Einpassen hängt nur von der Figur ab (sortiert alle Punkte): einmal je Bild-Name rechnen
if (!_fitCache.TryGetValue(_art, out _fit)) _fitCache[_art] = _fit = _model.FitNow();
double tFit = sw.Elapsed.TotalMilliseconds;
foreach (var c in new[] { "slash", "slash2", "slash3", "attack", "attack2" }) _model.ImpactTime(Clip3(c));
if (DevShot.Active) DevShot.Log($"timing: fighter {_art}: load {tLoad:0} skin {tSkin - tLoad:0} arm {tArm - tSkin:0} color {tColor - tArm:0} fit {tFit - tColor:0} impact {sw.Elapsed.TotalMilliseconds - tFit:0} ms");
_mfx = new BasicEffect(Assets.Device) { VertexColorEnabled = true, LightingEnabled = true, PreferPerPixelLighting = true };
// Kamera-Raum der Arena: x rechts, y nach unten, z zum Betrachter
_mfx.AmbientLightColor = new Vector3(0.45f, 0.40f, 0.37f);
@@ -71,12 +79,17 @@ namespace GladiatorIdle.Arena
case "foe_recruit": yield return "foe_slave"; break;
case "foe_provocator" or "foe_crupellarius" or "foe_praetorian" or "foe_eques":
yield return "foe_hoplomachus"; break;
case "foe_dimachaerus" or "foe_essedarius" or "foe_laquearius" or "foe_sagittarius":
yield return "foe_brawler"; break;
// der Raufbold kämpft mit Fäusten – Schwertkämpfer ohne eigene Figur nehmen Gladiatoren-Figuren
case "foe_dimachaerus" or "foe_essedarius":
yield return "hero_secutor_1"; break;
case "foe_laquearius" or "foe_sagittarius":
yield return "hero_thraex_1"; break;
}
yield return "foe_hoplomachus";
}
static readonly System.Collections.Generic.Dictionary<string, Matrix> _fitCache = new();
Model3D.Clip Clip3(string name) => _model!.Find(name) ?? _model!.Clips[0];
/// Clip und Zeit zum Zustand der Kampflogik.