adding in some needed packages
This commit is contained in:
parent
9e739f5dc8
commit
aba5310742
1012 changed files with 494191 additions and 1 deletions
54
Assets/DamageNumbersPro/Demo/Scripts/DNP_UIArea.cs
Normal file
54
Assets/DamageNumbersPro/Demo/Scripts/DNP_UIArea.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace DamageNumbersPro.Demo
|
||||
{
|
||||
public class DNP_UIArea : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
public static DNP_UIArea currentArea;
|
||||
public DNP_UIArea otherArea;
|
||||
public bool noSpawnArea = false;
|
||||
public bool breakCube = false;
|
||||
|
||||
RectTransform rectTransform;
|
||||
|
||||
void Start()
|
||||
{
|
||||
rectTransform = GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
currentArea = this;
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
if(currentArea == this)
|
||||
{
|
||||
currentArea = null;
|
||||
}
|
||||
}
|
||||
public static RectTransform GetRect()
|
||||
{
|
||||
return currentArea != null ? (currentArea.otherArea == null ? currentArea.rectTransform : currentArea.otherArea.rectTransform) : null;
|
||||
}
|
||||
|
||||
public static bool CanSpawn()
|
||||
{
|
||||
return currentArea == null || currentArea.noSpawnArea == false;
|
||||
}
|
||||
|
||||
public static void OnSpawn()
|
||||
{
|
||||
if(currentArea != null && currentArea.breakCube)
|
||||
{
|
||||
DNP_FallingCube cube = currentArea.GetComponent<DNP_FallingCube>();
|
||||
cube.Break();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue