1
0
Fork 0
boss-room/Assets/Scripts/FireballSpawner.cs
Ava Gaiety Wroten 425450a137 Hero spawner WIP
2021-07-10 21:53:12 -05:00

22 lines
602 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;
}
}
}