change: Implemented the cymbals as a pogo mechanic for projectiles
This commit is contained in:
@@ -2,23 +2,26 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ProjectileEnemy : MonoBehaviour {
|
||||
public class ProjectileEnemy : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] GameObject projectile;
|
||||
[SerializeField] GameObject firePoint;
|
||||
[SerializeField] [Range(0.1f, 3f)] float fireSpeed;
|
||||
[SerializeField][Range(0.1f, 3f)] float fireSpeed;
|
||||
[SerializeField] float projectileSpeed;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine(Fire());
|
||||
}
|
||||
|
||||
IEnumerator Fire() {
|
||||
yield return new WaitForSeconds(1/fireSpeed);
|
||||
IEnumerator Fire()
|
||||
{
|
||||
yield return new WaitForSeconds(1 / fireSpeed);
|
||||
GameObject newProjectile = Instantiate(projectile, firePoint.transform.position, firePoint.transform.rotation);
|
||||
newProjectile.GetComponent<Rigidbody2D>().AddRelativeForce(new Vector2(projectileSpeed, 0));
|
||||
newProjectile.transform.Rotate(new Vector3(0,0,-90));
|
||||
newProjectile.transform.Rotate(new Vector3(0, 0, -90));
|
||||
StartCoroutine(Fire());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user