03.5 Objects Save Data
What´s InteractedState () & TriggeredState(). How to override them.
// Open or close the door based on whether it is interacted or not
// InteractedState is called after loading
public override void InteractedState()
{
// If we interacted with the door, it means it is opened
if (interacted)
{
doorPivot.position = initialPos + offsetPosition;
doorPivot.localRotation =
Quaternion.Euler(new Vector3(
doorPivot.localRotation.x,
openedDoorRotation * side,
doorPivot.localRotation.z));
}
else // If interacted is false, the Door is closed.
{
doorPivot.position = initialPos;
doorPivot.rotation = closedRot;
}
}Last updated