1
0
Fork 0
boss-room/Assets/Scripts/Fireball.cs
2021-07-12 15:50:46 -05:00

30 lines
601 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Fireball : MonoBehaviour
{
public float speed = 1.0f;
public AudioSource[] shootSounds;
private int shootSoundVariations = 5;
void Start()
{
shootSounds[Random.Range(0, shootSoundVariations - 1)].GetComponent<AudioSource>().Play();
}
void Update()
{
Move();
}
void Move()
{
transform.position += transform.up * speed * Time.deltaTime * -1;
}
void OnTriggerEnter2D(Collider2D collider)
{
if (collider.name == "ColliderOuterBoundary") Destroy(gameObject);
}
}