70 lines
2.4 KiB
C#
70 lines
2.4 KiB
C#
using DamageNumbersPro;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
namespace Continentis.MainGame
|
|
{
|
|
[CreateAssetMenu(menuName = "Continentis/MainGame/BasePrefabs", fileName = "MainGameBasePrefabs")]
|
|
public partial class BasePrefabs : SerializedScriptableObject
|
|
{
|
|
[Title("Character")]
|
|
public GameObject combatCharacterView;
|
|
|
|
[Title("Cards")]
|
|
public GameObject handCardObject;
|
|
public GameObject intentionCardObject;
|
|
public GameObject inspectionCardObject;
|
|
|
|
[Title("GeneralUI")]
|
|
public GameObject informationBox;
|
|
|
|
[Title("CombatUI")]
|
|
public GameObject pointerArrow;
|
|
public GameObject hudContainer;
|
|
|
|
[Title("Texts")]
|
|
public GameObject hurtDamageNumber;
|
|
public GameObject blockedDamageNumber;
|
|
public GameObject healNumber;
|
|
public GameObject informationText;
|
|
}
|
|
|
|
public partial class BasePrefabs
|
|
{
|
|
public DamageNumber GenerateHurtText(int amount, Vector3 position)
|
|
{
|
|
DamageNumber hurtText = GenerateCombatText(hurtDamageNumber, position);
|
|
hurtText.number = amount;
|
|
return hurtText;
|
|
}
|
|
|
|
public DamageNumber GenerateBlockedText(int amount, Vector3 position)
|
|
{
|
|
DamageNumber blockedText = GenerateCombatText(blockedDamageNumber, position);
|
|
blockedText.number = amount;
|
|
return blockedText;
|
|
}
|
|
|
|
public DamageNumber GenerateHealText(int amount, Vector3 position)
|
|
{
|
|
DamageNumber healText = GenerateCombatText(healNumber, position);
|
|
healText.number = amount;
|
|
return healText;
|
|
}
|
|
|
|
public DamageNumber GenerateInfoText(string content, Vector3 position, Color color = default, float size = 1)
|
|
{
|
|
DamageNumber infoText = GenerateCombatText(informationText, position, color, size);
|
|
infoText.leftText = content;
|
|
return infoText;
|
|
}
|
|
|
|
public DamageNumber GenerateCombatText(GameObject textPrefab, Vector3 position, Color color = default, float size = 1)
|
|
{
|
|
DamageNumber combatText = Instantiate(textPrefab, position, Quaternion.identity).GetComponent<DamageNumber>();
|
|
if (color != default) combatText.SetColor(color);
|
|
combatText.SetScale(size);
|
|
return combatText;
|
|
}
|
|
}
|
|
} |