Spawner.cs 475 B

123456789101112131415
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Spawner : MonoBehaviour {
  5. public GameObject prefeb;
  6. public EnemyType type;
  7. public enum EnemyType { Arrow, Mover, Heavy }
  8. public GameObject parent;
  9. public void Spawn() {
  10. GameObject obj = Instantiate(prefeb, transform);
  11. obj.transform.parent = parent.transform;
  12. obj.GetComponent<EnemyBase>().movingLeft = transform.localScale.x < 0;
  13. }
  14. }