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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user