Created
May 6, 2020 09:08
-
-
Save SenpaiRar/ced2b2e03d2bf65c0d9fc3ffb4eed57e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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