generic pool made
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Darkmatter.Core;
|
||||
using Darkmatter.Domain;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
|
||||
@@ -11,6 +12,7 @@ public class PlatformManager : MonoBehaviour,IPlatformManager
|
||||
|
||||
[SerializeField] private float inputScale = 360f;
|
||||
float rotAmount = 0;
|
||||
public bool hasFirstPlatformBuilt = false;
|
||||
|
||||
|
||||
private void Start()
|
||||
@@ -47,6 +49,15 @@ public class PlatformManager : MonoBehaviour,IPlatformManager
|
||||
{
|
||||
foreach (Platform platform in pool.All)
|
||||
{
|
||||
if (!hasFirstPlatformBuilt)
|
||||
{
|
||||
platform.SetPlatformRule(new FirstPlatformRule());
|
||||
hasFirstPlatformBuilt=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
platform.SetPlatformRule(new OtherPlatformRule());
|
||||
}
|
||||
platform.gameObject.SetActive(true);
|
||||
platform.transform.position = new Vector3(0, yPos, 0);
|
||||
yPos--;
|
||||
@@ -56,6 +67,8 @@ public class PlatformManager : MonoBehaviour,IPlatformManager
|
||||
public void BuildNewPlatform()
|
||||
{
|
||||
Platform platform = pool.GetFromPool();
|
||||
platform.SetPlatformRule(new OtherPlatformRule());
|
||||
platform.gameObject.SetActive(true);
|
||||
platform.transform.position = new Vector3(0, yPos, 0);
|
||||
yPos--;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user