角色死亡
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Continentis.MainGame.Character;
|
||||
using Lean.Pool;
|
||||
using SLSFramework.UModAssistance;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Continentis.MainGame.Combat
|
||||
{
|
||||
[Serializable]
|
||||
public partial class CombatCharacterController
|
||||
{
|
||||
[Header("References")]
|
||||
@@ -100,30 +104,42 @@ namespace Continentis.MainGame.Combat
|
||||
|
||||
public void SetViewPositions()
|
||||
{
|
||||
float playerSideLeftBound = -7f;
|
||||
float playerSideRightBound = -1f;
|
||||
float playerSideLeftBound = -7.5f;
|
||||
float playerSideRightBound = -1.5f;
|
||||
float playerBaseInterval = 2f;
|
||||
|
||||
if (playerHeroes.Count > 4)
|
||||
{
|
||||
playerBaseInterval = (playerSideRightBound - playerSideLeftBound) / (playerHeroes.Count - 1);
|
||||
}
|
||||
|
||||
playerHeroes.Sort((x, y) => x.data.combatPositionOrder.CompareTo(y.data.combatPositionOrder));
|
||||
for (int index = 0; index < playerHeroes.Count; index++)
|
||||
{
|
||||
float xPos = playerHeroes.Count > 1
|
||||
? Mathf.Lerp(playerSideLeftBound, playerSideRightBound, (float)index / (playerHeroes.Count - 1))
|
||||
: (playerSideLeftBound + playerSideRightBound) / 2;
|
||||
float xPos = playerSideLeftBound + index * playerBaseInterval;
|
||||
Vector3 position = new Vector3(xPos, -1, 0);
|
||||
playerHeroes[index].characterView.transform.position = position;
|
||||
}
|
||||
|
||||
|
||||
float enemySideLeftBound = 1f;
|
||||
float enemySideRightBound = 7f;
|
||||
float enemySideLeftBound = 1.5f;
|
||||
float enemySideRightBound = 7.5f;
|
||||
float enemyBaseInterval = 2f;
|
||||
|
||||
if (enemies.Count > 4)
|
||||
{
|
||||
enemyBaseInterval = (enemySideRightBound - enemySideLeftBound) / (enemies.Count - 1);
|
||||
}
|
||||
|
||||
enemies.Sort((x, y) => y.data.combatPositionOrder.CompareTo(x.data.combatPositionOrder));
|
||||
for (int index = 0; index < enemies.Count; index++)
|
||||
{
|
||||
float xPos = enemies.Count > 1
|
||||
? Mathf.Lerp(enemySideLeftBound, enemySideRightBound, (float)index / (enemies.Count - 1))
|
||||
: (enemySideLeftBound + enemySideRightBound) / 2;
|
||||
float xPos = enemySideLeftBound + index * enemyBaseInterval;
|
||||
Vector3 position = new Vector3(xPos, -1, 0);
|
||||
enemies[index].characterView.transform.position = position;
|
||||
}
|
||||
|
||||
Debug.Log($"Enemy are sorted: {string.Join(", ", enemies.Select(e => e.data.displayName))}");
|
||||
}
|
||||
|
||||
public void SetViewHUDs()
|
||||
@@ -170,6 +186,31 @@ namespace Continentis.MainGame.Combat
|
||||
}
|
||||
}
|
||||
|
||||
public partial class CombatCharacterController
|
||||
{
|
||||
public void RemoveCharacter(CharacterBase character)
|
||||
{
|
||||
characters.Remove(character);
|
||||
actionOrderList.Remove(character);
|
||||
combatCharacterViews.Remove(character.characterView);
|
||||
|
||||
if (character is PlayerHero playerHero)
|
||||
{
|
||||
playerHeroes.Remove(playerHero);
|
||||
}
|
||||
else if (character is CombatNPC npc)
|
||||
{
|
||||
npcs[character.fraction].Remove(npc);
|
||||
}
|
||||
|
||||
Object.Destroy(character.characterView.hudContainer.gameObject);
|
||||
Object.Destroy(character.characterView.gameObject);
|
||||
|
||||
SetViewPositions();
|
||||
SetViewHUDs();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class CombatCharacterController
|
||||
{
|
||||
public List<CharacterBase> GetAllAllies(CharacterBase character, bool includeSelf = false)
|
||||
|
||||
@@ -88,6 +88,9 @@ namespace Continentis.MainGame.Combat
|
||||
public void NextRound()
|
||||
{
|
||||
currentRound++;
|
||||
|
||||
CombatUIManager.Instance.combatMainPage.roundHint.PlayRoundHint(currentRound);
|
||||
|
||||
eventCollection.onRoundStart.Invoke();
|
||||
foreach (CharacterBase character in characterController.characters)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user