using System.Collections; using System.Collections.Generic; using UnityEngine; public class Creeper : Opponent { [SerializeField] private GameObject[] creeplings; [SerializeField] private float creeplingsSpawnRange = 2f; public override void Death() { for (int i = 0; i < creeplings.Length; i++) { float randomX = Random.Range(0f, creeplingsSpawnRange) + transform.position.x; Vector3 spawnPosition = new Vector3(randomX, transform.position.y, transform.position.z); Instantiate(creeplings[i], spawnPosition, Quaternion.identity); } base.Death(); } }