mirror of
https://github.com/evgen-app/steampunk-quest.git
synced 2024-11-13 03:46:34 +03:00
26 lines
819 B
C#
26 lines
819 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class FakeActiveButtonScript : MonoBehaviour
|
|
{
|
|
private activePointSpawner _pointSpawner;
|
|
[SerializeField]
|
|
private CrossButtonHandler _notFakeButton;
|
|
private Canvas canvas;
|
|
void Start() {
|
|
_pointSpawner = Object.FindObjectOfType<activePointSpawner>();
|
|
canvas = Object.FindObjectOfType<Canvas>();
|
|
}
|
|
void Update() {
|
|
if (Input.GetMouseButtonDown(0)) {
|
|
if(Vector3.Distance(transform.position, Input.mousePosition) < 100) {
|
|
_pointSpawner.delete();
|
|
GameObject obj = Instantiate(_notFakeButton.gameObject, Input.mousePosition, Quaternion.identity);
|
|
obj.transform.SetParent(canvas.gameObject.transform);
|
|
obj.GetComponent<CrossButtonHandler>().active = true;
|
|
}
|
|
}
|
|
}
|
|
}
|