53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using InfallibleCode;
|
|
|
|
public class WindowTriggerAction : MonoBehaviour
|
|
{
|
|
public DraggableWindow window;
|
|
|
|
public bool LockWindow;
|
|
public bool UnlockWindow;
|
|
public bool OpenWindow;
|
|
public bool CloseWindow;
|
|
//[Range(0,0.5f)]
|
|
//[Tooltip("The lerp of the ")]
|
|
[Range(0, 5f)]
|
|
public float WindowSpeed = 0.5f;
|
|
private bool ActionPerformed;
|
|
|
|
private void OnTriggerEnter(Collider col)
|
|
{
|
|
if(col.gameObject.tag == "Player" && !ActionPerformed)
|
|
{
|
|
if (LockWindow)
|
|
{
|
|
window.LockWindow();
|
|
ActionPerformed = true;
|
|
}
|
|
else if (UnlockWindow)
|
|
{
|
|
window.UnlockWindow();
|
|
ActionPerformed = true;
|
|
}
|
|
if (OpenWindow)
|
|
{
|
|
window.OpenThisWindow(WindowSpeed);
|
|
window.UnlockWindow();
|
|
ActionPerformed = true;
|
|
}
|
|
else if (CloseWindow)
|
|
{
|
|
window.CloseThisWindow(WindowSpeed);
|
|
ActionPerformed = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ActionPerformedReset()
|
|
{
|
|
ActionPerformed = false;
|
|
}
|
|
}
|