Browse Source

Fix Game Over detection

tags/v1.5.0
NGnius (Graham) 3 years ago
parent
commit
89f354b647
1 changed files with 10 additions and 7 deletions
  1. +10
    -7
      GamecraftModdingAPI/Players/PlayerEngine.cs

+ 10
- 7
GamecraftModdingAPI/Players/PlayerEngine.cs View File

@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;

using RobocraftX.Character;
@@ -12,12 +14,16 @@ using RobocraftX.Character.Camera;
using RobocraftX.Character.Factories;
using Gamecraft.CharacterVulnerability;
using Gamecraft.CharacterVulnerability.Entities;
using Gamecraft.GUI.HUDFeedbackBlocks;
using Svelto.ECS;
using Unity.Mathematics;
using Unity.Physics;
using UnityEngine;

using GamecraftModdingAPI.Engines;
using HarmonyLib;
using RobocraftX.Common;
using Svelto.ECS.DataStructures;

namespace GamecraftModdingAPI.Players
{
@@ -365,15 +371,12 @@ namespace GamecraftModdingAPI.Players
public bool GetGameOverScreen(uint playerId)
{
if (entitiesDB == null) return false;
ref var c = ref GetCharacterStruct<CharacterLivesEntityComponent>(playerId, out bool exists);
if (exists)
{
return c.gameOverScreen;
}
return false;
ref HudActivatedBlocksEntityStruct habes = ref entitiesDB.QueryEntity<HudActivatedBlocksEntityStruct>(HUDFeedbackBlocksGUIExclusiveGroups.GameOverHudEgid);
NativeDynamicArrayCast<EGID> nativeDynamicArrayCast = new NativeDynamicArrayCast<EGID>(habes.activatedBlocksOrdered);
return nativeDynamicArrayCast.count > 0;
}

public bool IsDead(uint playerId)
public bool IsDead(uint playerId)
{
if (entitiesDB == null) return true;
return entitiesDB.Exists<RigidBodyEntityStruct>(playerId, CharacterExclusiveGroups.DeadCharacters);


Loading…
Cancel
Save