Musik Anderswelt & Effekte
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace RPGTALK.Snippets
|
||||
{
|
||||
[AddComponentMenu("Seize Studios/RPGTalk/Snippets/Can Pass Warning")]
|
||||
public class RPGTalkCanPassWarning : MonoBehaviour
|
||||
{
|
||||
|
||||
public UnityEvent OnCanPass, OnPassed;
|
||||
|
||||
RPGTalk rpgtalk;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
rpgtalk = GetComponent<RPGTalk>();
|
||||
rpgtalk.OnEndAnimating += CanPass;
|
||||
rpgtalk.OnPlayNext += Passed;
|
||||
rpgtalk.OnEndTalk += Passed;
|
||||
}
|
||||
|
||||
void CanPass()
|
||||
{
|
||||
if (rpgtalk.enablePass)
|
||||
{
|
||||
OnCanPass.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
void Passed()
|
||||
{
|
||||
OnPassed.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f70d00ddab7848c183ea67c3dac5a28
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,319 +0,0 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RPGTALK.Snippets
|
||||
{
|
||||
[AddComponentMenu("Seize Studios/RPGTalk/Snippets/Follow Character")]
|
||||
public class RPGTalkFollowCharacter : MonoBehaviour
|
||||
{
|
||||
[Header("Set ups")]
|
||||
public Canvas canvas;
|
||||
public RectTransform dialogWindow;
|
||||
|
||||
[Header("Camera Specs")]
|
||||
public bool rotateToTarget;
|
||||
public bool cameraBillboard;
|
||||
public Camera basedOnWhatCamera;
|
||||
|
||||
[Header("Limits")]
|
||||
public bool containInsideScreen;
|
||||
public float unitsToMoveWhenOutside = 1;
|
||||
public bool maximumIsInitialPoint = true;
|
||||
public bool mantainZ = true;
|
||||
|
||||
[Header("Pointer")]
|
||||
public RectTransform pointer;
|
||||
public Vector3 pointerInitialOffset;
|
||||
public bool mantainXDistanceFromClosestCorner;
|
||||
int closestCorner;
|
||||
|
||||
RPGTalk rpgTalk;
|
||||
|
||||
Vector3 initialPoint;
|
||||
bool doneFirst;
|
||||
|
||||
RPGTalkSmartPointer smartPointer;
|
||||
Vector3 pointerPos;
|
||||
|
||||
|
||||
bool following;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Awake()
|
||||
{
|
||||
rpgTalk = GetComponent<RPGTalk>();
|
||||
rpgTalk.OnNewTalk += BeginMove;
|
||||
rpgTalk.OnEndTalk += EndMove;
|
||||
if (pointer != null)
|
||||
{
|
||||
smartPointer = pointer.GetComponent<RPGTalkSmartPointer>();
|
||||
}
|
||||
}
|
||||
|
||||
void BeginMove()
|
||||
{
|
||||
following = true;
|
||||
}
|
||||
|
||||
void EndMove()
|
||||
{
|
||||
following = false;
|
||||
doneFirst = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!following || rpgTalk.following == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Make sure that anything that should follow is following and is billboarding
|
||||
Vector3 newPos = rpgTalk.following.position + rpgTalk.followingOffset;
|
||||
//If we mantain the z, we will keep the previous Z of the dialogWindow. Perfect for 2D projects.
|
||||
if (mantainZ)
|
||||
{
|
||||
newPos.z = dialogWindow.transform.position.z;
|
||||
}
|
||||
|
||||
//If our canvas was overlay, we want the pos to be screen based
|
||||
if (canvas != null && canvas.renderMode == RenderMode.ScreenSpaceOverlay)
|
||||
{
|
||||
newPos = basedOnWhatCamera.WorldToScreenPoint(newPos);
|
||||
//If it is behind the camera, we don't want to display it
|
||||
dialogWindow.gameObject.SetActive(newPos.z > 0);
|
||||
}
|
||||
|
||||
|
||||
Quaternion newRotation = Quaternion.identity;
|
||||
if (rotateToTarget)
|
||||
{
|
||||
newRotation = rpgTalk.following.rotation;
|
||||
}
|
||||
if (cameraBillboard)
|
||||
{
|
||||
newRotation = basedOnWhatCamera.transform.rotation;
|
||||
}
|
||||
|
||||
dialogWindow.transform.position = newPos;
|
||||
dialogWindow.transform.rotation = newRotation;
|
||||
|
||||
//If the pointer was a smart pointer, we want to set the end of it to our following obj.
|
||||
if (smartPointer != null)
|
||||
{
|
||||
//If our canvas was overlay, we want the pos to be screen based
|
||||
if (canvas == null || canvas.renderMode == RenderMode.WorldSpace)
|
||||
{
|
||||
smartPointer.endPoint = rpgTalk.following.position;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get the corners of the recttransform
|
||||
Vector3[] corners = new Vector3[4];
|
||||
dialogWindow.GetWorldCorners(corners);
|
||||
|
||||
//Settings for the first time we run
|
||||
if (!doneFirst)
|
||||
{
|
||||
//doneFirst = true;
|
||||
initialPoint = dialogWindow.transform.position;
|
||||
//If we got a pointer, let's teleport it to the initial position
|
||||
if (pointer != null)
|
||||
{
|
||||
pointerPos = initialPoint;
|
||||
pointerPos.y = corners[0].y;
|
||||
//If we want to mantain X distance, let's find out what is the closest corner
|
||||
if (mantainXDistanceFromClosestCorner)
|
||||
{
|
||||
closestCorner = -1;
|
||||
for (int i = 0; i < corners.Length; i++)
|
||||
{
|
||||
|
||||
//Vector3.distance is heavy. Changing it to sqrMagnitude
|
||||
if (closestCorner == -1 || (pointer.position - corners[i]).sqrMagnitude < (pointer.position - corners[closestCorner]).sqrMagnitude)
|
||||
{
|
||||
closestCorner = i;
|
||||
}
|
||||
|
||||
}
|
||||
pointerPos.x = corners[closestCorner].x;
|
||||
}
|
||||
//If our canvas was overlay, we want the pos to be screen based
|
||||
if (canvas != null && canvas.renderMode == RenderMode.ScreenSpaceOverlay)
|
||||
{
|
||||
pointerPos = basedOnWhatCamera.ScreenToWorldPoint(pointerPos);
|
||||
}
|
||||
pointer.position = pointerPos + pointerInitialOffset;
|
||||
|
||||
|
||||
|
||||
}
|
||||
//If our canvas was overlay, we want the pos to be screen based
|
||||
if (canvas != null && canvas.renderMode == RenderMode.ScreenSpaceOverlay)
|
||||
{
|
||||
pointerPos = basedOnWhatCamera.ScreenToWorldPoint(pointerPos);
|
||||
initialPoint = basedOnWhatCamera.ScreenToWorldPoint(initialPoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//If our canvas was overlay, we want the pos to be screen based
|
||||
if (canvas != null && canvas.renderMode == RenderMode.ScreenSpaceOverlay)
|
||||
{
|
||||
|
||||
if (smartPointer != null && pointer.parent == dialogWindow.transform)
|
||||
{
|
||||
|
||||
pointerPos = dialogWindow.transform.position;
|
||||
pointerPos.y = corners[0].y;
|
||||
|
||||
if (mantainXDistanceFromClosestCorner)
|
||||
{
|
||||
pointerPos.x = corners[closestCorner].x;
|
||||
}
|
||||
|
||||
|
||||
Vector3 followingPoint = rpgTalk.following.position + rpgTalk.followingOffset;
|
||||
Vector3 followingPointScreen = basedOnWhatCamera.WorldToScreenPoint(followingPoint);
|
||||
|
||||
Vector3 directionBetweenPoints = (pointerPos - dialogWindow.position).normalized;
|
||||
|
||||
Vector3 appliedOffset = pointerInitialOffset;
|
||||
appliedOffset.x *= directionBetweenPoints.x;
|
||||
appliedOffset.y *= directionBetweenPoints.y;
|
||||
appliedOffset.z *= directionBetweenPoints.z;
|
||||
|
||||
|
||||
Vector3 cornerOnWorld = basedOnWhatCamera.ScreenToWorldPoint(pointerPos + appliedOffset);
|
||||
Vector3 followOnWorld = basedOnWhatCamera.ScreenToWorldPoint(followingPointScreen);
|
||||
|
||||
|
||||
pointer.position = cornerOnWorld;
|
||||
smartPointer.endPoint = followOnWorld;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (containInsideScreen)
|
||||
{
|
||||
|
||||
|
||||
//If our canvas was overlay, we want the pos to be screen based
|
||||
if (canvas != null && canvas.renderMode == RenderMode.ScreenSpaceOverlay)
|
||||
{
|
||||
|
||||
|
||||
if (basedOnWhatCamera.ScreenToViewportPoint(corners[2]).x > 1 && basedOnWhatCamera.ScreenToViewportPoint(corners[0]).x < 0)
|
||||
{
|
||||
Debug.LogError("Your Canvas was out left and right at the same time! I don't know what to do!");
|
||||
return;
|
||||
}
|
||||
if (basedOnWhatCamera.ScreenToViewportPoint(corners[1]).y > 1 && basedOnWhatCamera.ScreenToViewportPoint(corners[0]).y < 0)
|
||||
{
|
||||
Debug.LogError("Your Canvas was out top and bottom at the same time! I don't know what to do!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//if the left corners passed the view
|
||||
while (basedOnWhatCamera.ScreenToViewportPoint(corners[0]).x < 0 &&
|
||||
(!maximumIsInitialPoint || basedOnWhatCamera.ScreenToViewportPoint(corners[0]).x < basedOnWhatCamera.WorldToViewportPoint(initialPoint).x))
|
||||
{
|
||||
Vector3 newpos = dialogWindow.localPosition;
|
||||
newpos.x += unitsToMoveWhenOutside;
|
||||
dialogWindow.localPosition = newpos;
|
||||
dialogWindow.GetWorldCorners(corners);
|
||||
}
|
||||
//if the right corners passed the view
|
||||
while (basedOnWhatCamera.ScreenToViewportPoint(corners[2]).x > 1 &&
|
||||
(!maximumIsInitialPoint || basedOnWhatCamera.ScreenToViewportPoint(corners[2]).x > basedOnWhatCamera.WorldToViewportPoint(initialPoint).x))
|
||||
{
|
||||
Vector3 newpos = dialogWindow.localPosition;
|
||||
newpos.x -= unitsToMoveWhenOutside;
|
||||
dialogWindow.localPosition = newpos;
|
||||
dialogWindow.GetWorldCorners(corners);
|
||||
}
|
||||
|
||||
//if the bottom corners passed the view
|
||||
while (basedOnWhatCamera.ScreenToViewportPoint(corners[0]).y < 0 &&
|
||||
(!maximumIsInitialPoint || basedOnWhatCamera.ScreenToViewportPoint(corners[0]).y < basedOnWhatCamera.WorldToViewportPoint(initialPoint).y))
|
||||
{
|
||||
Vector3 newpos = dialogWindow.localPosition;
|
||||
newpos.y += unitsToMoveWhenOutside;
|
||||
dialogWindow.localPosition = newpos;
|
||||
dialogWindow.GetWorldCorners(corners);
|
||||
}
|
||||
//if the top corners passed the view
|
||||
while (basedOnWhatCamera.ScreenToViewportPoint(corners[1]).y > 1 &&
|
||||
(!maximumIsInitialPoint || basedOnWhatCamera.ScreenToViewportPoint(corners[1]).y > basedOnWhatCamera.WorldToViewportPoint(initialPoint).y))
|
||||
{
|
||||
Vector3 newpos = dialogWindow.localPosition;
|
||||
newpos.y -= unitsToMoveWhenOutside;
|
||||
dialogWindow.localPosition = newpos;
|
||||
dialogWindow.GetWorldCorners(corners);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if (basedOnWhatCamera.WorldToViewportPoint(corners[2]).x > 1 && basedOnWhatCamera.WorldToViewportPoint(corners[0]).x < 0)
|
||||
{
|
||||
Debug.LogError("Your Canvas was out left and right at the same time! I don't know what to do!");
|
||||
return;
|
||||
}
|
||||
if (basedOnWhatCamera.WorldToViewportPoint(corners[1]).y > 1 && basedOnWhatCamera.WorldToViewportPoint(corners[0]).y < 0)
|
||||
{
|
||||
Debug.LogError("Your Canvas was out top and bottom at the same time! I don't know what to do!");
|
||||
return;
|
||||
}
|
||||
//if the left corners passed the view
|
||||
while (basedOnWhatCamera.WorldToViewportPoint(corners[0]).x < 0 &&
|
||||
(!maximumIsInitialPoint || basedOnWhatCamera.WorldToViewportPoint(corners[0]).x < basedOnWhatCamera.WorldToViewportPoint(initialPoint).x))
|
||||
{
|
||||
Vector3 newpos = dialogWindow.localPosition;
|
||||
newpos.x += unitsToMoveWhenOutside;
|
||||
dialogWindow.localPosition = newpos;
|
||||
dialogWindow.GetWorldCorners(corners);
|
||||
}
|
||||
//if the right corners passed the view
|
||||
while (basedOnWhatCamera.WorldToViewportPoint(corners[2]).x > 1 &&
|
||||
(!maximumIsInitialPoint || basedOnWhatCamera.WorldToViewportPoint(corners[2]).x > basedOnWhatCamera.WorldToViewportPoint(initialPoint).x))
|
||||
{
|
||||
Vector3 newpos = dialogWindow.localPosition;
|
||||
newpos.x -= unitsToMoveWhenOutside;
|
||||
dialogWindow.localPosition = newpos;
|
||||
dialogWindow.GetWorldCorners(corners);
|
||||
}
|
||||
|
||||
//if the bottom corners passed the view
|
||||
while (basedOnWhatCamera.WorldToViewportPoint(corners[0]).y < 0 &&
|
||||
(!maximumIsInitialPoint || basedOnWhatCamera.WorldToViewportPoint(corners[0]).y < basedOnWhatCamera.WorldToViewportPoint(initialPoint).y))
|
||||
{
|
||||
Vector3 newpos = dialogWindow.localPosition;
|
||||
newpos.y += unitsToMoveWhenOutside;
|
||||
dialogWindow.localPosition = newpos;
|
||||
dialogWindow.GetWorldCorners(corners);
|
||||
}
|
||||
//if the top corners passed the view
|
||||
while (basedOnWhatCamera.WorldToViewportPoint(corners[1]).y > 1 &&
|
||||
(!maximumIsInitialPoint || basedOnWhatCamera.WorldToViewportPoint(corners[1]).y > basedOnWhatCamera.WorldToViewportPoint(initialPoint).y))
|
||||
{
|
||||
Vector3 newpos = dialogWindow.localPosition;
|
||||
newpos.y -= unitsToMoveWhenOutside;
|
||||
dialogWindow.localPosition = newpos;
|
||||
dialogWindow.GetWorldCorners(corners);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0d7a8a11a3f047148a3c6ec8fe8209c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,82 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RPGTALK.Snippets
|
||||
{
|
||||
[AddComponentMenu("Seize Studios/RPGTalk/Snippets/Save Instance")]
|
||||
[ExecuteInEditMode]
|
||||
public class RPGTalkSaveInstance : MonoBehaviour
|
||||
{
|
||||
|
||||
public bool saveBetweenPlays;
|
||||
[Header("Check the checkbox below to erase all saved data")]
|
||||
public bool erase;
|
||||
|
||||
RPGTalk rpgTalk;
|
||||
|
||||
List<string> savedInThisPlay = new List<string>();
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
rpgTalk = GetComponent<RPGTalk>();
|
||||
rpgTalk.OnMadeChoice += SaveData;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (erase)
|
||||
{
|
||||
erase = false;
|
||||
PlayerPrefs.DeleteAll();
|
||||
if (saveBetweenPlays)
|
||||
{
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
rpgTalk.OnMadeChoice -= SaveData;
|
||||
}
|
||||
|
||||
void OnApplicationQuit()
|
||||
{
|
||||
if (!saveBetweenPlays)
|
||||
{
|
||||
foreach(string todestroy in savedInThisPlay)
|
||||
{
|
||||
PlayerPrefs.DeleteKey(todestroy);
|
||||
}
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveData(string choiceID, int answerID)
|
||||
{
|
||||
PlayerPrefs.SetInt(choiceID, answerID);
|
||||
savedInThisPlay.Add(choiceID);
|
||||
if (saveBetweenPlays)
|
||||
{
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetSavedData(string savedData, int modifier)
|
||||
{
|
||||
if (PlayerPrefs.HasKey(savedData) && PlayerPrefs.GetInt(savedData) == modifier)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(!PlayerPrefs.HasKey(savedData) && modifier == -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0385d72fa46a499bb77554b7dc4ba79
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,68 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using RPGTALK.Texts;
|
||||
|
||||
namespace RPGTALK.Snippets
|
||||
{
|
||||
[AddComponentMenu("Seize Studios/RPGTalk/Snippets/Simple Animation")]
|
||||
public class RPGTalkSimpleAnimation : MonoBehaviour
|
||||
{
|
||||
|
||||
public int textSpeed = 30;
|
||||
public UnityEvent OnAnimationEnd;
|
||||
public bool startOnAwake = true;
|
||||
|
||||
TMP_Translator text;
|
||||
string originalText;
|
||||
bool animating;
|
||||
float currentChar;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
text = new TMP_Translator(gameObject);
|
||||
if (startOnAwake)
|
||||
{
|
||||
StartAnimating();
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (!animating)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// if there's still text left to show
|
||||
if (currentChar < originalText.Length)
|
||||
{
|
||||
|
||||
//ensure that we don't accidentally blow past the end of the string
|
||||
currentChar = Mathf.Min(currentChar + textSpeed * Time.deltaTime,
|
||||
originalText.Length);
|
||||
|
||||
//Do what we have to do if the the text just ended
|
||||
if (currentChar >= originalText.Length)
|
||||
{
|
||||
OnAnimationEnd.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
//Get the current char and the text and put it into the U
|
||||
text.ChangeTextTo(originalText.Substring(0, (int)currentChar));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void StartAnimating()
|
||||
{
|
||||
originalText = text.GetCurrentText();
|
||||
animating = true;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d70e149ebd994808a82da66d011d9c2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,103 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using RPGTALK.Timeline;
|
||||
|
||||
namespace RPGTALK.Snippets
|
||||
{
|
||||
[AddComponentMenu("Seize Studios/RPGTalk/Snippets/Skip Cutscene")]
|
||||
public class RPGTalkSkipCutscene : MonoBehaviour
|
||||
{
|
||||
public KeyCode keyToSkip = KeyCode.None;
|
||||
public string buttonToSkip = "";
|
||||
public bool skipWithMouse;
|
||||
public bool needToSkipTwice;
|
||||
public float timeBetweenSkips;
|
||||
public UnityEvent OnFirstTwiceSkip;
|
||||
public UnityEvent OnCancelTwiceSkip;
|
||||
public UnityEvent OnSkip;
|
||||
public bool canSkip = true;
|
||||
public bool jumpQuestions;
|
||||
public float delaySkip;
|
||||
|
||||
RPGTalk rpgtalk;
|
||||
bool isTalking;
|
||||
float timingSkip;
|
||||
bool delaying;
|
||||
RPGTalkTimeline timeline;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
rpgtalk = GetComponent<RPGTalk>();
|
||||
timeline = GetComponent<RPGTalkTimeline>();
|
||||
rpgtalk.OnNewTalk += OnTalkStart;
|
||||
rpgtalk.OnEndTalk += OnTalkFinish;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isTalking && canSkip && !delaying)
|
||||
{
|
||||
if ((keyToSkip != KeyCode.None && Input.GetKeyDown(keyToSkip)) ||
|
||||
(buttonToSkip != "" && Input.GetButtonDown(buttonToSkip)) ||
|
||||
(skipWithMouse && Input.GetMouseButtonDown(0)))
|
||||
{
|
||||
Skip();
|
||||
}
|
||||
|
||||
timingSkip -= Time.deltaTime;
|
||||
if (timingSkip <= 0)
|
||||
{
|
||||
OnCancelTwiceSkip.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Skip()
|
||||
{
|
||||
if (needToSkipTwice && timingSkip <= 0)
|
||||
{
|
||||
timingSkip = timeBetweenSkips;
|
||||
OnFirstTwiceSkip.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
OnSkip.Invoke();
|
||||
delaying = true;
|
||||
Invoke("ActuallySkip", delaySkip);
|
||||
}
|
||||
|
||||
void ActuallySkip()
|
||||
{
|
||||
delaying = false;
|
||||
|
||||
if (timeline != null)
|
||||
{
|
||||
timeline.Skip(jumpQuestions);
|
||||
}
|
||||
else
|
||||
{
|
||||
rpgtalk.EndTalk(jumpQuestions);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OnTalkStart()
|
||||
{
|
||||
|
||||
isTalking = true;
|
||||
}
|
||||
|
||||
void OnTalkFinish()
|
||||
{
|
||||
isTalking = false;
|
||||
if (timingSkip > 0)
|
||||
{
|
||||
timingSkip = 0;
|
||||
OnCancelTwiceSkip.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4d8e3149883248108807f99a65c3d19
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,64 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RPGTALK.Snippets
|
||||
{
|
||||
[AddComponentMenu("Seize Studios/RPGTalk/Snippets/Smart Pointer")]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(LineRenderer))]
|
||||
public class RPGTalkSmartPointer : MonoBehaviour
|
||||
{
|
||||
|
||||
public Vector3 endPoint;
|
||||
public bool ignoreZFromEndPoint;
|
||||
LineRenderer line;
|
||||
public Vector3 endPointOffset;
|
||||
public float maximumStretch = 2;
|
||||
public Vector3 addOffsetAfterMaximumStretch;
|
||||
public float maximumStretchWithOffset = 10;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
line = GetComponent<LineRenderer>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (line == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
line.SetPosition(0, transform.position);
|
||||
|
||||
Vector3 newpos = endPoint;
|
||||
if (ignoreZFromEndPoint)
|
||||
{
|
||||
newpos.z = transform.position.z;
|
||||
}
|
||||
newpos += endPointOffset;
|
||||
//Vector3.distance is heavy. Changing it to sqrMagnitude
|
||||
if ((transform.position - newpos).sqrMagnitude > maximumStretch * maximumStretch)
|
||||
{
|
||||
float passedStretch = (maximumStretch * maximumStretch) - (transform.position - newpos).sqrMagnitude;
|
||||
Vector3 appliedOffset = addOffsetAfterMaximumStretch * passedStretch;
|
||||
newpos = transform.position + ((newpos - transform.position).normalized * maximumStretch);
|
||||
newpos = newpos + appliedOffset;
|
||||
|
||||
if ((transform.position - newpos).sqrMagnitude > maximumStretchWithOffset * maximumStretchWithOffset)
|
||||
{
|
||||
newpos = transform.position + ((newpos - transform.position).normalized * maximumStretchWithOffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
line.SetPosition(line.positionCount - 1, newpos);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93658e28a47594d26b29769f45642317
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user