unified scene working - small but with inventory and portals. has simple fix coming - overlaps in script use buttons still here, need flags to fix - simple torso for player character

This commit is contained in:
2022-04-05 10:21:55 +03:00
parent 53893b63a6
commit ccafc9e970
58 changed files with 18075 additions and 6403 deletions

View File

@@ -26,22 +26,27 @@ public class PortalTeleporter : MonoBehaviour
traveller = other.gameObject.transform;
if (_portalIsEnabled && !_justUsed)
{
linkedPortal._portalIsEnabled = false;
_travellerIsOverlapping = true;
if (other.tag == "Throwable")
if (other.name.StartsWith("Holster"))
{
Debug.Log("Portal entered by throwable");
HandleThrowable();
Debug.Log("holster");
}
else if (other.tag == "Player")
else
{
Debug.Log("Portal entered by player");
HandlePlayer();
linkedPortal._portalIsEnabled = false;
_travellerIsOverlapping = true;
if (other.tag == "Throwable")
{
Debug.Log("Portal entered by throwable");
HandleThrowable();
}
else if (other.tag == "Player")
{
Debug.Log("Portal entered by player");
HandlePlayer();
}
}
}
}
private void HandlePlayer()
{
Vector3 portalToTraveller = traveller.position - transform.position;
@@ -54,7 +59,10 @@ public class PortalTeleporter : MonoBehaviour
rotationDiff += 180;
traveller.Rotate(Vector3.up, rotationDiff);
Vector3 positionOffset = Quaternion.Euler(0f, rotationDiff, 0f) * portalToTraveller;
// Teleport
traveller.position = linkedPortalTransform.position + positionOffset;
AudioSource.PlayClipAtPoint(TeleportSound, traveller.position, 1);
_travellerIsOverlapping = false;
_portalIsEnabled = false;