Initial commit
This commit is contained in:
38
Assets/Scripts/PlatformScript/PlatformManager.cs
Normal file
38
Assets/Scripts/PlatformScript/PlatformManager.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
|
||||
public class PlatformManager : MonoBehaviour
|
||||
{
|
||||
private GameObject currentPlatfrom;
|
||||
[Inject] private PlatformPool pool;
|
||||
|
||||
private int yPos=0;
|
||||
|
||||
void Start()
|
||||
{
|
||||
ShowInitialPlatforms();
|
||||
}
|
||||
|
||||
public void ShowInitialPlatforms()
|
||||
{
|
||||
|
||||
foreach(var platfrom in pool.platformPool)
|
||||
{
|
||||
platfrom.gameObject.SetActive(true);
|
||||
platfrom.transform.position = new Vector3(0,yPos,0);
|
||||
yPos--;
|
||||
}
|
||||
}
|
||||
public void BuildPlatform()
|
||||
{
|
||||
currentPlatfrom = pool.GetPlatformFromPool();
|
||||
if(currentPlatfrom!=null)
|
||||
{
|
||||
currentPlatfrom.transform.position = new Vector3(0,yPos,0);
|
||||
currentPlatfrom.SetActive(true);
|
||||
yPos--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user