Improved feel of Troll Window
This commit is contained in:
@@ -5,7 +5,7 @@ namespace InterfaceOff
|
||||
public class TrollWindow : WindowBase
|
||||
{
|
||||
private int m_Health = int.MaxValue;
|
||||
private bool m_SpawnOnRight = true;
|
||||
private bool m_SpawnOnRight;
|
||||
|
||||
public override void OnWindowInstantiation()
|
||||
{
|
||||
@@ -21,6 +21,9 @@ namespace InterfaceOff
|
||||
|
||||
public override void OnWindowCloseButtonClicked()
|
||||
{
|
||||
/* Removes info text as it can overlap with the close button */
|
||||
Components.InfoText.text = string.Empty;
|
||||
|
||||
/* Decreases health and destroys if at 0 */
|
||||
m_Health--;
|
||||
if (m_Health <= 0)
|
||||
@@ -30,7 +33,7 @@ namespace InterfaceOff
|
||||
}
|
||||
|
||||
/* If not at zero randomly moves the close button */
|
||||
float randX = m_SpawnOnRight ? Random.Range(0, 80) : Random.Range(-80, 0);
|
||||
float randX = m_SpawnOnRight ? Random.Range(20, 80) : Random.Range(-80, -20);
|
||||
m_SpawnOnRight = !m_SpawnOnRight; // Makes sure the close button is semi far away
|
||||
|
||||
Components.CloseButtonRectTransform.anchoredPosition = new Vector2(randX, 0);
|
||||
|
||||
Reference in New Issue
Block a user