28 lines
715 B
C#
28 lines
715 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Creeper : Opponent
|
|
{
|
|
[SerializeField]
|
|
private GameObject creeplings;
|
|
[SerializeField]
|
|
private int creeplingsCount = 3;
|
|
|
|
public override void Death()
|
|
{
|
|
for (int i = 0; i < creeplingsCount; i++)
|
|
{
|
|
SpawnCreeplings();
|
|
}
|
|
base.Death();
|
|
}
|
|
|
|
private void SpawnCreeplings()
|
|
{
|
|
float randomX = Random.Range(0f, 2f) + transform.position.x;
|
|
Vector3 spawnPosition = new Vector3(randomX, transform.position.y, transform.position.z);
|
|
GameObject creeplingsInstance = Instantiate(creeplings, spawnPosition, Quaternion.identity);
|
|
}
|
|
}
|