1
0
Fork 0
boss-room/Assets/Scenes/Scripts/FireballSpawner.cs
2021-07-10 17:24:26 -05:00

25 lines
749 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class FireballSpawner : MonoBehaviour
{
public GameObject dragonHead;
public GameObject fireball;
void Update()
{
if (Input.GetMouseButtonDown(0))
{
Vector3 mouseClickFromCamera = Camera.main.ScreenToWorldPoint(Input.mousePosition);
mouseClickFromCamera.z = 0;
GameObject spawnedFireball = Instantiate(fireball, dragonHead.transform.position, Quaternion.identity);
spawnedFireball.GetComponent<Fireball>().destination = mouseClickFromCamera;
/* Debug.Log(mouseClickFromCamera); */
/* Debug.Log(dragonHead.transform.position); */
/* gameObject.transform.position = pz; */
}
}
}