```
docs(clipboard): 添加剪贴板功能相关图片资源 添加了两个剪贴板功能的截图文件,用于文档说明和功能展示。 ```
This commit is contained in:
1 parent
47f01ecd2e
commit
f93d69d8ee
77 files changed
+5482
-307
No files matched your search
@@ -24,8 +24,7 @@ public class MainCharacterCombat : MonoBehaviour
|
||||
public Transform attackPos;
|
||||
|
||||
[Header("召唤单位")]
|
||||
public GameObject humanSoldierPrefab;
|
||||
public GameObject archerPrefab;
|
||||
public CharacterData[] summonableCharacters = new CharacterData[5];
|
||||
public float summonDistance = 1.5f;
|
||||
public float summonSideOffset = 0.8f;
|
||||
public float summonSearchStep = 0.8f;
|
||||
@@ -48,6 +47,8 @@ public class MainCharacterCombat : MonoBehaviour
|
||||
private bool attacking;
|
||||
private bool attackEffectTriggered;
|
||||
private GameObject pendingSummonPrefab;
|
||||
private CharacterData pendingSummonCharacterData;
|
||||
private PlayerCharacterData pendingSummonPlayerData;
|
||||
private float summonElapsed;
|
||||
private bool summonSpawned;
|
||||
private bool summoning;
|
||||
@@ -136,16 +137,32 @@ public class MainCharacterCombat : MonoBehaviour
|
||||
return false;
|
||||
}
|
||||
|
||||
GameObject prefab = slot == 1
|
||||
? humanSoldierPrefab
|
||||
: slot == 2
|
||||
? archerPrefab
|
||||
: null;
|
||||
if (prefab == null)
|
||||
int index = slot - 1;
|
||||
if (index < 0 || index >= summonableCharacters.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CharacterData characterData = summonableCharacters[index];
|
||||
if (characterData == null || characterData.unitPrefab == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ManaSystem.Instance == null || !ManaSystem.Instance.TryConsumeMana(characterData.manaCost))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCharacterData playerData = PlayerDataManager.Instance != null
|
||||
? PlayerDataManager.Instance.GetDeckCharacter(index)
|
||||
: null;
|
||||
|
||||
if (playerData == null)
|
||||
{
|
||||
playerData = new PlayerCharacterData(characterData.characterId, 1, 0);
|
||||
}
|
||||
|
||||
if (movement != null)
|
||||
{
|
||||
movement.StopMovement();
|
||||
@@ -156,11 +173,11 @@ public class MainCharacterCombat : MonoBehaviour
|
||||
FinishAttack();
|
||||
}
|
||||
|
||||
BeginSummon(prefab);
|
||||
BeginSummon(characterData.unitPrefab, characterData, playerData);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void BeginSummon(GameObject prefab)
|
||||
private void BeginSummon(GameObject prefab, CharacterData characterData, PlayerCharacterData playerData)
|
||||
{
|
||||
if (prefab == null)
|
||||
{
|
||||
@@ -168,6 +185,8 @@ public class MainCharacterCombat : MonoBehaviour
|
||||
}
|
||||
|
||||
pendingSummonPrefab = prefab;
|
||||
pendingSummonCharacterData = characterData;
|
||||
pendingSummonPlayerData = playerData;
|
||||
summonElapsed = 0f;
|
||||
summonSpawned = false;
|
||||
summoning = true;
|
||||
@@ -201,9 +220,27 @@ public class MainCharacterCombat : MonoBehaviour
|
||||
spawnPosition,
|
||||
Quaternion.LookRotation(direction, Vector3.up));
|
||||
summoned.tag = "Friend";
|
||||
|
||||
UnitBase unitBase = summoned.GetComponent<UnitBase>();
|
||||
if (unitBase != null && pendingSummonCharacterData != null && pendingSummonPlayerData != null)
|
||||
{
|
||||
float finalHealth = pendingSummonPlayerData.GetMaxHealth(pendingSummonCharacterData);
|
||||
float finalAttack = pendingSummonPlayerData.GetAttackPower(pendingSummonCharacterData);
|
||||
float finalSpeed = pendingSummonPlayerData.GetMoveSpeed(pendingSummonCharacterData);
|
||||
|
||||
unitBase.InitializeFromPlayerData(finalHealth, finalAttack, finalSpeed);
|
||||
|
||||
Debug.Log($"主角召唤单位:{summoned.name} Lv.{pendingSummonPlayerData.level} HP={finalHealth} ATK={finalAttack} position={spawnPosition}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("主角召唤单位:" + summoned.name + " position=" + spawnPosition);
|
||||
}
|
||||
|
||||
summonSpawned = true;
|
||||
pendingSummonPrefab = null;
|
||||
Debug.Log("主角召唤单位:" + summoned.name + " position=" + spawnPosition);
|
||||
pendingSummonCharacterData = null;
|
||||
pendingSummonPlayerData = null;
|
||||
}
|
||||
|
||||
private bool TryFindSummonPosition(Vector3 direction, out Vector3 position)
|
||||
|
||||
Reference in new issue
Block a user