update 1.2.5
This commit is contained in:
@@ -17,6 +17,7 @@ namespace EmeraldAI
|
||||
public GameObject CombatTextCanvas;
|
||||
[HideInInspector]
|
||||
public EmeraldCombatTextData m_EmeraldAICombatTextData;
|
||||
|
||||
Transform m_CombatTextParent;
|
||||
|
||||
private void Awake()
|
||||
@@ -29,6 +30,19 @@ namespace EmeraldAI
|
||||
CombatTextObject = (GameObject)Resources.Load("Combat Text") as GameObject;
|
||||
m_CombatTextParent = CombatTextCanvas.transform.GetChild(0);
|
||||
m_EmeraldAICombatTextData = (EmeraldCombatTextData)Resources.Load("Combat Text Data") as EmeraldCombatTextData;
|
||||
|
||||
if (!m_EmeraldAICombatTextData.VRSupport)
|
||||
{
|
||||
CombatTextCanvas.transform.localScale = Vector3.one;
|
||||
CombatTextCanvas.GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
}
|
||||
else
|
||||
{
|
||||
CombatTextCanvas.transform.localScale = Vector3.one * 0.01f;
|
||||
CombatTextCanvas.GetComponent<Canvas>().renderMode = RenderMode.WorldSpace;
|
||||
CombatTextCanvas.GetComponent<CanvasScaler>().dynamicPixelsPerUnit = 3;
|
||||
CombatTextCanvas.GetComponent<Canvas>().worldCamera = Camera.main;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateCombatText(int amount, Vector3 TextPosition, bool CriticalHit, bool HealingText, bool PlayerTakingDamage)
|
||||
@@ -49,6 +63,7 @@ namespace EmeraldAI
|
||||
m_Text.text = amount.ToString();
|
||||
m_Text.font = m_EmeraldAICombatTextData.TextFont;
|
||||
m_Text.fontSize = m_EmeraldAICombatTextData.FontSize;
|
||||
if (m_EmeraldAICombatTextData.VRSupport) m_Text.transform.localScale = Vector3.one * 0.6f;
|
||||
|
||||
Outline m_OutLine = t.GetComponent<Outline>();
|
||||
if (m_EmeraldAICombatTextData.OutlineEffect == EmeraldCombatTextData.OutlineEffectEnum.Enabled)
|
||||
@@ -87,11 +102,12 @@ namespace EmeraldAI
|
||||
var t = EmeraldAI.Utility.EmeraldObjectPool.Spawn(CombatTextObject, TextPosition + Vector3.up, Quaternion.identity);
|
||||
t.transform.SetParent(m_CombatTextParent);
|
||||
t.transform.position = Vector3.zero;
|
||||
|
||||
|
||||
Text m_Text = t.GetComponent<Text>();
|
||||
m_Text.text = Amount.ToString();
|
||||
m_Text.font = m_EmeraldAICombatTextData.TextFont;
|
||||
m_Text.fontSize = m_EmeraldAICombatTextData.FontSize;
|
||||
if (m_EmeraldAICombatTextData.VRSupport) m_Text.transform.localScale = Vector3.one * 0.6f;
|
||||
|
||||
Outline m_OutLine = t.GetComponent<Outline>();
|
||||
if (m_EmeraldAICombatTextData.OutlineEffect == EmeraldCombatTextData.OutlineEffectEnum.Enabled)
|
||||
@@ -162,8 +178,15 @@ namespace EmeraldAI
|
||||
t += Time.deltaTime;
|
||||
float r = 1.0f - (t / 1);
|
||||
Vector3 m_TextPos = TargetPosition + new Vector3(r - RandomXPosition, Mathf.Sin(r * Mathf.PI), 0);
|
||||
m_TextPos = Camera.main.WorldToScreenPoint(m_TextPos - Vector3.right + Vector3.up * m_EmeraldAICombatTextData.DefaultHeight / 2);
|
||||
m_TextPos.z = 0.0f;
|
||||
if (!m_EmeraldAICombatTextData.VRSupport)
|
||||
{
|
||||
m_TextPos = Camera.main.WorldToScreenPoint(m_TextPos - Vector3.right + Vector3.up * m_EmeraldAICombatTextData.DefaultHeight / 2);
|
||||
m_TextPos.z = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TextPos = (m_TextPos - Vector3.right + Vector3.up * m_EmeraldAICombatTextData.DefaultHeight / 2);
|
||||
}
|
||||
|
||||
if (m_EmeraldAICombatTextData.UseAnimateFontSize == EmeraldCombatTextData.UseAnimateFontSizeEnum.Enabled)
|
||||
{
|
||||
@@ -186,6 +209,7 @@ namespace EmeraldAI
|
||||
}
|
||||
|
||||
m_Text.transform.position = m_TextPos;
|
||||
if (m_EmeraldAICombatTextData.VRSupport) RotateTowardsCamera(m_Text.transform);
|
||||
|
||||
yield return null;
|
||||
}
|
||||
@@ -233,8 +257,15 @@ namespace EmeraldAI
|
||||
t += Time.deltaTime*0.75f;
|
||||
float r = 1.0f - (t / 1);
|
||||
Vector3 m_TextPos = TargetPosition + new Vector3(RandomXPosition, -r * m_EmeraldAICombatTextData.DefaultHeight, 0);
|
||||
m_TextPos = Camera.main.WorldToScreenPoint(m_TextPos + Vector3.up * m_EmeraldAICombatTextData.DefaultHeight);
|
||||
m_TextPos.z = 0.0f;
|
||||
if (!m_EmeraldAICombatTextData.VRSupport)
|
||||
{
|
||||
m_TextPos = Camera.main.WorldToScreenPoint(m_TextPos + Vector3.up * m_EmeraldAICombatTextData.DefaultHeight);
|
||||
m_TextPos.z = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TextPos = (m_TextPos + Vector3.up * m_EmeraldAICombatTextData.DefaultHeight);
|
||||
}
|
||||
|
||||
if (m_EmeraldAICombatTextData.UseAnimateFontSize == EmeraldCombatTextData.UseAnimateFontSizeEnum.Enabled)
|
||||
{
|
||||
@@ -257,6 +288,7 @@ namespace EmeraldAI
|
||||
}
|
||||
|
||||
m_Text.transform.position = m_TextPos;
|
||||
if (m_EmeraldAICombatTextData.VRSupport) RotateTowardsCamera(m_Text.transform);
|
||||
|
||||
yield return null;
|
||||
}
|
||||
@@ -321,9 +353,18 @@ namespace EmeraldAI
|
||||
m_TextPos = TargetPosition + new Vector3(Mathf.Lerp(0, RandomXPosition, 1 - r), -r * m_EmeraldAICombatTextData.DefaultHeight + Mathf.Sin(r + RandomYPosition * Mathf.PI), 0);
|
||||
}
|
||||
|
||||
m_TextPos = Camera.main.WorldToScreenPoint(m_TextPos+Vector3.up*RandomYPosition);
|
||||
m_TextPos.z = 0.0f;
|
||||
if (!m_EmeraldAICombatTextData.VRSupport)
|
||||
{
|
||||
m_TextPos = Camera.main.WorldToScreenPoint(m_TextPos + Vector3.up * RandomYPosition);
|
||||
m_TextPos.z = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TextPos = (m_TextPos + Vector3.up * RandomYPosition);
|
||||
}
|
||||
|
||||
m_Text.transform.position = m_TextPos;
|
||||
if (m_EmeraldAICombatTextData.VRSupport) RotateTowardsCamera(m_Text.transform);
|
||||
|
||||
if (m_EmeraldAICombatTextData.UseAnimateFontSize == EmeraldCombatTextData.UseAnimateFontSizeEnum.Enabled)
|
||||
{
|
||||
@@ -392,8 +433,15 @@ namespace EmeraldAI
|
||||
{
|
||||
t += Time.deltaTime;
|
||||
Vector3 m_TextPos = TargetPosition + new Vector3(RandomXPosition, RandomYPosition, 0);
|
||||
m_TextPos = Camera.main.WorldToScreenPoint(m_TextPos - Vector3.up * 0.5f);
|
||||
m_TextPos.z = 0.0f;
|
||||
if (!m_EmeraldAICombatTextData.VRSupport)
|
||||
{
|
||||
m_TextPos = Camera.main.WorldToScreenPoint(m_TextPos - Vector3.up * 0.5f);
|
||||
m_TextPos.z = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TextPos = (m_TextPos - Vector3.up * 0.5f);
|
||||
}
|
||||
|
||||
if (m_EmeraldAICombatTextData.UseAnimateFontSize == EmeraldCombatTextData.UseAnimateFontSizeEnum.Enabled)
|
||||
{
|
||||
@@ -416,11 +464,18 @@ namespace EmeraldAI
|
||||
}
|
||||
|
||||
m_Text.transform.position = m_TextPos;
|
||||
if (m_EmeraldAICombatTextData.VRSupport) RotateTowardsCamera(m_Text.transform);
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
EmeraldAI.Utility.EmeraldObjectPool.Despawn(m_Text.gameObject);
|
||||
}
|
||||
|
||||
void RotateTowardsCamera (Transform Source)
|
||||
{
|
||||
Vector3 directionAwayFromCamera = Source.position - Camera.main.transform.position;
|
||||
Source.rotation = Quaternion.LookRotation(directionAwayFromCamera);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ namespace EmeraldAI.Utility
|
||||
SerializedProperty OutlineEffect;
|
||||
SerializedProperty UseAnimateFontSize;
|
||||
SerializedProperty TextHeight;
|
||||
SerializedProperty VRSupport;
|
||||
|
||||
[MenuItem("Window/Emerald AI/Combat Text Manager #%c", false, 200)]
|
||||
public static void ShowWindow()
|
||||
@@ -61,6 +62,7 @@ namespace EmeraldAI.Utility
|
||||
OutlineEffect = serializedObject.FindProperty("OutlineEffect");
|
||||
UseAnimateFontSize = serializedObject.FindProperty("UseAnimateFontSize");
|
||||
TextHeight = serializedObject.FindProperty("DefaultHeight");
|
||||
VRSupport = serializedObject.FindProperty("VRSupport");
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
@@ -131,6 +133,12 @@ namespace EmeraldAI.Utility
|
||||
GUI.backgroundColor = Color.white;
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(VRSupport, new GUIContent("VR Support"));
|
||||
GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
|
||||
EditorGUILayout.HelpBox("Changes the Combat Text System's canvas to World Space to allow it to work with VR (this setting cannot be changed during runtime as it's set up when the CTS is initialized).", MessageType.None, true);
|
||||
GUI.backgroundColor = Color.white;
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUILayout.PropertyField(TextHeight, new GUIContent("Combat Text Height"));
|
||||
GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.19f);
|
||||
EditorGUILayout.HelpBox("Controls the overall height the Combat Text will spawn above targets.", MessageType.None, true);
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace EmeraldAI.Utility
|
||||
}
|
||||
|
||||
//If there are no available attacks, ignore the cooldowns and pick a random ability to avoid an error.
|
||||
//if (AvailableAttacks.Count == 0 && SentAttackClass.AttackPickType != AttackPickTypes.Order)
|
||||
if (AvailableAttacks.Count == 0)
|
||||
{
|
||||
SetAttackValues(EmeraldComponent, SentAttackClass.AttackDataList[Random.Range(0, SentAttackClass.AttackDataList.Count)], true);
|
||||
@@ -169,7 +168,7 @@ namespace EmeraldAI.Utility
|
||||
/// <summary>
|
||||
/// Check each condition for the passed ability to see if they can be used.
|
||||
/// </summary>
|
||||
static bool CheckAbilityConditions (EmeraldSystem EmeraldComponent, AttackClass.AttackData AttackData)
|
||||
static bool CheckAbilityConditions(EmeraldSystem EmeraldComponent, AttackClass.AttackData AttackData)
|
||||
{
|
||||
if (AttackData.AbilityObject.ConditionSettings.ConditionType == ConditionTypes.SelfLowHealth)
|
||||
{
|
||||
@@ -195,8 +194,14 @@ namespace EmeraldAI.Utility
|
||||
}
|
||||
else if (AttackData.AbilityObject.ConditionSettings.ConditionType == ConditionTypes.DistanceFromTarget)
|
||||
{
|
||||
return EmeraldComponent.CombatComponent.DistanceFromTarget <= AttackData.AbilityObject.ConditionSettings.DistanceFromTarget && AttackData.AbilityObject.ConditionSettings.ValueCompareType == AbilityData.ConditionData.ValueCompareTypes.LessThan ||
|
||||
EmeraldComponent.CombatComponent.DistanceFromTarget >= AttackData.AbilityObject.ConditionSettings.DistanceFromTarget && AttackData.AbilityObject.ConditionSettings.ValueCompareType == AbilityData.ConditionData.ValueCompareTypes.GreaterThan;
|
||||
if (AttackData.AbilityObject.ConditionSettings.ValueCompareType == AbilityData.ConditionData.ValueCompareTypes.LessThan)
|
||||
{
|
||||
return EmeraldComponent.CombatComponent.DistanceFromTarget <= AttackData.AbilityObject.ConditionSettings.DistanceFromTarget;
|
||||
}
|
||||
else if (AttackData.AbilityObject.ConditionSettings.ValueCompareType == AbilityData.ConditionData.ValueCompareTypes.GreaterThan)
|
||||
{
|
||||
return EmeraldComponent.CombatComponent.DistanceFromTarget >= AttackData.AbilityObject.ConditionSettings.DistanceFromTarget;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user