Fix Game Over detection

This commit is contained in:
NGnius (Graham) 2020-08-13 10:12:36 -04:00
parent 8354123169
commit 89f354b647

View file

@ -1,4 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using RobocraftX.Character; using RobocraftX.Character;
@ -12,12 +14,16 @@ using RobocraftX.Character.Camera;
using RobocraftX.Character.Factories; using RobocraftX.Character.Factories;
using Gamecraft.CharacterVulnerability; using Gamecraft.CharacterVulnerability;
using Gamecraft.CharacterVulnerability.Entities; using Gamecraft.CharacterVulnerability.Entities;
using Gamecraft.GUI.HUDFeedbackBlocks;
using Svelto.ECS; using Svelto.ECS;
using Unity.Mathematics; using Unity.Mathematics;
using Unity.Physics; using Unity.Physics;
using UnityEngine; using UnityEngine;
using GamecraftModdingAPI.Engines; using GamecraftModdingAPI.Engines;
using HarmonyLib;
using RobocraftX.Common;
using Svelto.ECS.DataStructures;
namespace GamecraftModdingAPI.Players namespace GamecraftModdingAPI.Players
{ {
@ -365,15 +371,12 @@ namespace GamecraftModdingAPI.Players
public bool GetGameOverScreen(uint playerId) public bool GetGameOverScreen(uint playerId)
{ {
if (entitiesDB == null) return false; if (entitiesDB == null) return false;
ref var c = ref GetCharacterStruct<CharacterLivesEntityComponent>(playerId, out bool exists); ref HudActivatedBlocksEntityStruct habes = ref entitiesDB.QueryEntity<HudActivatedBlocksEntityStruct>(HUDFeedbackBlocksGUIExclusiveGroups.GameOverHudEgid);
if (exists) NativeDynamicArrayCast<EGID> nativeDynamicArrayCast = new NativeDynamicArrayCast<EGID>(habes.activatedBlocksOrdered);
{ return nativeDynamicArrayCast.count > 0;
return c.gameOverScreen;
}
return false;
} }
public bool IsDead(uint playerId) public bool IsDead(uint playerId)
{ {
if (entitiesDB == null) return true; if (entitiesDB == null) return true;
return entitiesDB.Exists<RigidBodyEntityStruct>(playerId, CharacterExclusiveGroups.DeadCharacters); return entitiesDB.Exists<RigidBodyEntityStruct>(playerId, CharacterExclusiveGroups.DeadCharacters);