Cease v0.5
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Scampz.GameJam.Assets.Scripts;
|
||||
using Scampz.GameJam.Assets.Scripts.Audio;
|
||||
using Scampz.GameJam.Assets.Scripts.Utilities;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
@@ -23,6 +23,9 @@ namespace Scampz.GameJam
|
||||
|
||||
public bool IsTalking = false;
|
||||
|
||||
private InputAction confirmAction;
|
||||
private InputAction escapeAction;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null && Instance != this)
|
||||
@@ -36,12 +39,24 @@ namespace Scampz.GameJam
|
||||
|
||||
public void Start()
|
||||
{
|
||||
escapeAction = new InputAction("cancel", binding: "<Keyboard>/escape");
|
||||
escapeAction.AddBinding("<GamePad>/buttonEast");
|
||||
escapeAction.Enable();
|
||||
confirmAction = new InputAction("confirm", binding: "<Keyboard>/x");
|
||||
confirmAction.AddBinding("<GamePad>/buttonSouth");
|
||||
confirmAction.Enable();
|
||||
sentences = new Queue<string>();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
confirmAction.Disable();
|
||||
escapeAction.Disable();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (IsTalking && Input.GetButtonDown(InputOptions.Cancel))
|
||||
if (IsTalking && escapeAction.triggered)
|
||||
EndDialogue();
|
||||
}
|
||||
|
||||
@@ -93,7 +108,7 @@ namespace Scampz.GameJam
|
||||
yield return null;
|
||||
SFXManager.Instance.StopSoundEffect();
|
||||
yield return new WaitForSeconds(0.3f);
|
||||
yield return new WaitForKeyDown(InputOptions.Submit);
|
||||
yield return new WaitForKeyDown(confirmAction);
|
||||
SFXManager.Instance.PlaySoundEffect(SoundEffectName.Ok);
|
||||
DisplayNextSentence(dialogue);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Scampz.GameJam.Assets.Scripts;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
@@ -10,6 +10,20 @@ namespace Scampz.GameJam
|
||||
|
||||
private bool _isWithinRange = false;
|
||||
|
||||
private InputAction confirmAction;
|
||||
|
||||
void Start()
|
||||
{
|
||||
confirmAction = new InputAction("confirm", binding: "<Keyboard>/x");
|
||||
confirmAction.AddBinding("<GamePad>/buttonSouth");
|
||||
confirmAction.Enable();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
confirmAction.Disable();
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Player"))
|
||||
@@ -24,7 +38,7 @@ namespace Scampz.GameJam
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_isWithinRange && Input.GetButtonDown(InputOptions.Submit) && !DialogueManager.Instance.IsTalking)
|
||||
if (_isWithinRange && confirmAction.triggered && !DialogueManager.Instance.IsTalking)
|
||||
{
|
||||
var player = GameObject.FindGameObjectWithTag("Player");
|
||||
var cc = player.GetComponent<CharacterController>();
|
||||
|
||||
Reference in New Issue
Block a user