This repository has been archived on 2024-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
sota/RunningLateGame/Assets/Scripts/LiftButtonInteractable.cs

33 lines
809 B
C#
Raw Normal View History

2024-08-10 12:11:35 +00:00
/*
2024-08-11 05:51:29 +00:00
* authors: mark joshwel, ryan lin
2024-08-10 12:11:35 +00:00
* date: 10/8/2024
* description: lift button behaviour implementation
*/
using UnityEngine;
/// <summary>
/// lift button behaviour implementation
/// </summary>
public class LiftButtonInteractable : CommonInteractable
{
2024-08-11 05:51:29 +00:00
/// <summary>
/// the number of floors the lift will move
/// </summary>
public int floorsMoved;
2024-08-10 12:11:35 +00:00
/// <summary>
/// the lift the button is controlling
/// </summary>
[SerializeField] private LiftController liftController;
2024-08-11 05:51:29 +00:00
[SerializeField] private Door door;
/// <summary>
/// a function to interact with the lift
/// </summary>
2024-08-10 12:11:35 +00:00
public override void Interact()
{
2024-08-11 05:51:29 +00:00
if (!liftController.moving && !door.isOpen) StartCoroutine(liftController.Move(floorsMoved));
2024-08-10 12:11:35 +00:00
}
}