imported grappling files
This commit is contained in:
22
Assets/Scripts/ProjectileEnemy.cs
Normal file
22
Assets/Scripts/ProjectileEnemy.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ProjectileEnemy : MonoBehaviour {
|
||||
|
||||
[SerializeField] GameObject projectile;
|
||||
[SerializeField] GameObject firePoint;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
StartCoroutine(Fire());
|
||||
}
|
||||
|
||||
IEnumerator Fire() {
|
||||
yield return new WaitForSeconds(3f);
|
||||
GameObject newProjectile = Instantiate(projectile, firePoint.transform.position, firePoint.transform.rotation);
|
||||
newProjectile.GetComponent<Rigidbody2D>().AddRelativeForce(new Vector2(80, 0));
|
||||
newProjectile.transform.Rotate(new Vector3(0,0,45));
|
||||
StartCoroutine(Fire());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user