i3e-asg2/Assets/Scripts/SpaceshipDoor.cs

26 lines
684 B
C#
Raw Normal View History

2024-06-24 13:26:41 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpaceshipDoor : Interactable
{
bool IsOpen = false;
public override void Interact()
{
if (!IsOpen)
{
Vector3 currentRotation = transform.eulerAngles;
currentRotation.z += 115;
transform.eulerAngles = currentRotation;
IsOpen = true;
}
else
{
Vector3 currentRotation = transform.eulerAngles;
currentRotation.z -= 115;
transform.eulerAngles = currentRotation;
IsOpen = false;
}
}
}