Implement hand menu features

This commit is contained in:
2024-09-07 20:42:45 +02:00
parent f690fb53c8
commit 3357191134
621 changed files with 410674 additions and 3861 deletions

View File

@@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace DamageNumbersPro.Demo
{
public class DNP_VillagerSpawner : MonoBehaviour
{
public GameObject prefab;
public Vector3 fromPosition;
public Vector3 toPosition;
float nextSpawnTime;
void Start()
{
nextSpawnTime = Time.time + 1f;
DNP_Enemy.count = 0;
}
void FixedUpdate()
{
if(Time.time > nextSpawnTime && DNP_Enemy.count < 4)
{
SpawnVillager();
}
}
void SpawnVillager()
{
nextSpawnTime = Time.time + 2f * Random.value + 3f;
GameObject newVillager = Instantiate<GameObject>(prefab);
newVillager.transform.position = Vector3.Lerp(fromPosition, toPosition, Random.value);
newVillager.SetActive(true);
}
}
}