Skip to content

Instantly share code, notes, and snippets.

@SenpaiRar
Created May 6, 2020 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SenpaiRar/ced2b2e03d2bf65c0d9fc3ffb4eed57e to your computer and use it in GitHub Desktop.
Save SenpaiRar/ced2b2e03d2bf65c0d9fc3ffb4eed57e to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SinoSodalEnemy : Enemy
{
public Vector3 Target;
public Vector3 Direction;
public GameObject SinosodalBulletObject;
private void Start(){
Target = GameObject.FindGameObjectWithTag("Player").transform.position;
Direction = Target-transform.position;
StartCoroutine(SpawnSines());
}
public override void SpawnRoutine(Vector3 T){
Instantiate(this.gameObject, new Vector3(T.x, 0, T.z), Quaternion.identity);
}
IEnumerator SpawnSines(){
float x = 10f;
StartCoroutine(DoIt());
while(x > 0){
x -= Time.smoothDeltaTime;
yield return null;
}
StopCoroutine(DoIt());
Destroy(gameObject);
}
IEnumerator DoIt(){
for(;;){
Instantiate(SinosodalBulletObject, transform.position, Quaternion.LookRotation(Direction));
yield return new WaitForSecondsRealtime(0.1f);
}
}
public override void TakeDamage(int T){
//do nothing
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment