Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2715ba7a86 | |||
| 778653994d |
+1349
-1
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class FastTravelIcon : MonoBehaviour
|
||||
{
|
||||
public Transform TravelLocation;
|
||||
TeleportHandler TeleportHandler;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
TeleportHandler = GameObject.FindWithTag("Player").GetComponent<TeleportHandler>();
|
||||
}
|
||||
|
||||
public void GoToLocation()
|
||||
{
|
||||
TeleportHandler.FastTravel(TravelLocation, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3711c2e3d35fde4c8fd02cebc72979d
|
||||
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class MapPlayerIcon : MonoBehaviour
|
||||
{
|
||||
public Vector3 RealMapBottomRight;
|
||||
public Vector3 RealMapTopLeft;
|
||||
|
||||
RectTransform MapTransform;
|
||||
RectTransform PlayerIconTransform;
|
||||
|
||||
void Start()
|
||||
{
|
||||
PlayerIconTransform = GetComponent<RectTransform>();
|
||||
MapTransform = PlayerIconTransform.parent.GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
Vector3 playerPos = GameManager.Instance.PlayerController.transform.position;
|
||||
|
||||
float worldMinX = RealMapTopLeft.x;
|
||||
float worldMaxX = RealMapBottomRight.x;
|
||||
float worldMinZ = RealMapBottomRight.z;
|
||||
float worldMaxZ = RealMapTopLeft.z;
|
||||
|
||||
// translate player position to percentage of map for x and y
|
||||
float normalizedX = Mathf.InverseLerp(worldMinX, worldMaxX, playerPos.x);
|
||||
float normalizedY = Mathf.InverseLerp(worldMinZ, worldMaxZ, playerPos.z);
|
||||
|
||||
// anchor is 0, subtract 0.5 for accurate coords
|
||||
PlayerIconTransform.anchoredPosition = new Vector2((normalizedX - 0.5f) * MapTransform.rect.width, (normalizedY -0.5f) * MapTransform.rect.height);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f08acec5e7dc5004a9b3427a8e19b5f4
|
||||
+32042
-942
File diff suppressed because it is too large
Load Diff
@@ -43,23 +43,7 @@ void Update()
|
||||
// TODO: Move input detection somewhere else
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
if (!paused)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Time.timeScale = 0;
|
||||
canUseTools = false;
|
||||
hasControl = false;
|
||||
GameManager.Instance.MenuController.ShowScreen("Pause");
|
||||
}
|
||||
else
|
||||
{
|
||||
Time.timeScale = 1;
|
||||
canUseTools = true;
|
||||
hasControl = true;
|
||||
GameManager.Instance.MenuController.HideAllScreens();
|
||||
}
|
||||
|
||||
paused = !paused;
|
||||
TogglePause();
|
||||
}
|
||||
|
||||
if (hasControl)
|
||||
@@ -86,6 +70,27 @@ void Update()
|
||||
DoMovement();
|
||||
}
|
||||
|
||||
public void TogglePause()
|
||||
{
|
||||
if (!paused)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Time.timeScale = 0;
|
||||
canUseTools = false;
|
||||
hasControl = false;
|
||||
GameManager.Instance.MenuController.ShowScreen("Pause");
|
||||
}
|
||||
else
|
||||
{
|
||||
Time.timeScale = 1;
|
||||
canUseTools = true;
|
||||
hasControl = true;
|
||||
GameManager.Instance.MenuController.HideAllScreens();
|
||||
}
|
||||
|
||||
paused = !paused;
|
||||
}
|
||||
|
||||
#region Movement Calculation/Input Processing
|
||||
/// <summary>
|
||||
/// If player presses space, jump
|
||||
@@ -384,6 +389,16 @@ public void CharacterControllerMove(Vector3 movement)
|
||||
characterController.Move(movement);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the character controller's position
|
||||
/// </summary>
|
||||
public void CharacterControllerSetPosition(Vector3 pos)
|
||||
{
|
||||
characterController.enabled = false;
|
||||
transform.position = pos;
|
||||
characterController.enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Auto-walk the character in the specified direction. Uses character's walk
|
||||
/// speed and camera rotation (per-frame)
|
||||
|
||||
@@ -13,6 +13,19 @@ private void Start()
|
||||
playerController = GetComponent<PlayerController>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the fast travel coroutine
|
||||
/// </summary>
|
||||
public void FastTravel(Transform position, bool isPaused)
|
||||
{
|
||||
if (isPaused)
|
||||
{
|
||||
GameManager.Instance.PlayerController.TogglePause();
|
||||
}
|
||||
|
||||
StartCoroutine(FastTravelCoroutine(position));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the room entrance coroutine, only works if the character is not controllable (keeps from double transitioning)
|
||||
/// </summary>
|
||||
@@ -74,4 +87,41 @@ IEnumerator EnterRoomCoroutine(RoomDoor door)
|
||||
playerController.SetCharacterControl(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle teleportation and timing for fast travel
|
||||
/// </summary>
|
||||
IEnumerator FastTravelCoroutine(Transform location)
|
||||
{
|
||||
float fadeDuration = 0.2f; // how long to fade to/from black
|
||||
float fadeTime = 0;
|
||||
Color blackScreenColor = Color.black;
|
||||
|
||||
playerController.SetCharacterControl(false);
|
||||
|
||||
while (fadeTime < fadeDuration)
|
||||
{
|
||||
blackScreenColor.a = Mathf.Lerp(0, 1, fadeTime / fadeDuration);
|
||||
GameManager.Instance.BlackScreen.color = blackScreenColor;
|
||||
fadeTime += Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
fadeTime = 0;
|
||||
|
||||
playerController.CharacterControllerSetPosition(location.position);
|
||||
|
||||
while (fadeTime < fadeDuration)
|
||||
{
|
||||
blackScreenColor.a = Mathf.Lerp(1, 0, fadeTime / fadeDuration);
|
||||
GameManager.Instance.BlackScreen.color = blackScreenColor;
|
||||
|
||||
fadeTime += Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
fadeTime = 0;
|
||||
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
playerController.SetCharacterControl(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,12 @@ public class Talkable : Interactable
|
||||
public void Start()
|
||||
{
|
||||
voice = GetComponent<DialogueVoice>();
|
||||
|
||||
if (talkIndicator != null)
|
||||
{
|
||||
talkIndicator.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
void DetermineDialogue()
|
||||
{
|
||||
@@ -90,17 +94,27 @@ public override void Interact()
|
||||
else
|
||||
GameManager.Instance.DialogueManager.DisplayNextSentence();
|
||||
|
||||
if (talkIndicator != null)
|
||||
{
|
||||
talkIndicator.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void MoveInsideRange()
|
||||
{
|
||||
if (talkIndicator != null)
|
||||
{
|
||||
talkIndicator.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void MoveOutsideRange()
|
||||
{
|
||||
GameManager.Instance.DialogueManager.EndDialogue();
|
||||
|
||||
if (talkIndicator != null)
|
||||
{
|
||||
talkIndicator.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LFS
BIN
Binary file not shown.
@@ -0,0 +1,117 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff5af43c5cbc5064d90c8078a8b2e90a
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user