Arena version of Land_Of_Death (KF)
This commit is contained in:
31
Assets/Scripts/TEMP_SCRIPTS/TEMP_GATE_CONTROLLER.cs
Normal file
31
Assets/Scripts/TEMP_SCRIPTS/TEMP_GATE_CONTROLLER.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GateController : MonoBehaviour
|
||||
{
|
||||
public Vector3 openOffset = new Vector3(0, 3, 0);
|
||||
public float openSpeed = 2f;
|
||||
|
||||
private Vector3 closedPosition;
|
||||
private Vector3 targetPosition;
|
||||
private bool isOpening = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
closedPosition = transform.position;
|
||||
targetPosition = closedPosition;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (isOpening)
|
||||
{
|
||||
transform.position = Vector3.MoveTowards(transform.position, targetPosition, openSpeed * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenGate()
|
||||
{
|
||||
targetPosition = closedPosition + openOffset;
|
||||
isOpening = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user