Initial commit
This commit is contained in:
27
Assets/Scripts/PlatformScript/Platform.cs
Normal file
27
Assets/Scripts/PlatformScript/Platform.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
|
||||
public class Platform : MonoBehaviour
|
||||
{
|
||||
private Transform playerTransform;
|
||||
[Inject] private PlatformPool pool;
|
||||
[Inject] private PlatformManager manager;
|
||||
[Inject] private IInputReader inputReader;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if((playerTransform.position.y-transform.position.y)<-5)
|
||||
{
|
||||
pool.ReturnToPool(this.gameObject);
|
||||
manager.BuildPlatform();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user