You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using UltraCombos;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
|
|
|
|
|
|
|
public class FlakeSpawner : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
public GameObject prefab;
|
|
|
|
|
|
|
|
|
|
|
|
public DShowClip[] clips;
|
|
|
|
|
|
|
|
|
|
|
|
List<RaycastResult> raycastResults = new List<RaycastResult>();
|
|
|
|
|
|
|
|
|
|
|
|
public void TrySpawn(Vector2 position)
|
|
|
|
|
|
{
|
|
|
|
|
|
PointerEventData data = new PointerEventData(EventSystem.current);
|
|
|
|
|
|
data.position = position;
|
|
|
|
|
|
raycastResults.Clear();
|
|
|
|
|
|
EventSystem.current.RaycastAll(data, raycastResults);
|
|
|
|
|
|
bool found = raycastResults.Select(r => r.gameObject.layer == LayerMask.NameToLayer("Flake")).Any(b => b);
|
|
|
|
|
|
if (found)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
GameObject obj = Instantiate(prefab, transform.parent);
|
|
|
|
|
|
(obj.transform as RectTransform).anchoredPosition = position;
|
|
|
|
|
|
obj.GetComponent<DShowPooledMoviePlayer>().VideoAsset = clips[Random.Range(0, clips.Length)];
|
|
|
|
|
|
obj.SetActive(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|