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>();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Scampz.GameJam.Assets.Scripts.Player;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts
|
||||
{
|
||||
@@ -10,6 +11,28 @@ namespace Scampz.GameJam.Assets.Scripts
|
||||
public float RotateSpeed = 720.0f;
|
||||
private float _ySpeed = 0f;
|
||||
private PlayerState _playerState;
|
||||
public PlayerControls playerControls;
|
||||
private InputAction move;
|
||||
private InputAction sprint;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
playerControls = new PlayerControls();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
move = playerControls.Player.Move;
|
||||
sprint = playerControls.Player.Sprint;
|
||||
move.Enable();
|
||||
sprint.Enable();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
move.Disable();
|
||||
sprint.Disable();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -25,12 +48,10 @@ namespace Scampz.GameJam.Assets.Scripts
|
||||
void Move()
|
||||
{
|
||||
var movementSpeed = Speed;
|
||||
if (Input.GetButton(InputOptions.Sprint))
|
||||
if (sprint.IsPressed())
|
||||
movementSpeed *= 2;
|
||||
var horizontalMovement = Input.GetAxisRaw(InputOptions.Horizontal);
|
||||
var verticalMovement = Input.GetAxisRaw(InputOptions.Vertical);
|
||||
|
||||
var movementDirection = new Vector3(-horizontalMovement, 0, -verticalMovement);
|
||||
var movement = move.ReadValue<Vector2>();
|
||||
var movementDirection = new Vector3(-movement.x, 0, -movement.y);
|
||||
var magnitude = Mathf.Clamp01(movementDirection.magnitude) * movementSpeed;
|
||||
movementDirection.Normalize();
|
||||
_ySpeed += Physics.gravity.y * Time.deltaTime;
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace Scampz.GameJam.Assets.Scripts
|
||||
{
|
||||
public static class InputOptions
|
||||
{
|
||||
public static string Vertical => "Vertical";
|
||||
|
||||
public static string Horizontal => "Horizontal";
|
||||
|
||||
public static string Submit => "Submit";
|
||||
|
||||
public static string Cancel => "Cancel";
|
||||
|
||||
public static string Sprint => "Sprint";
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 032f3415ba7c171498cf298f0fb45c7e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,12 +1,27 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts.Player
|
||||
{
|
||||
public class TalkedToAirshipGuy : MonoBehaviour
|
||||
{
|
||||
private InputAction confirmAction;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
confirmAction = new InputAction("confirm", binding: "<Keyboard>/x");
|
||||
confirmAction.AddBinding("<GamePad>/buttonSouth");
|
||||
confirmAction.Enable();
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
confirmAction.Disable();
|
||||
}
|
||||
|
||||
public void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (Input.GetButton(InputOptions.Submit))
|
||||
if (confirmAction.triggered)
|
||||
UnlockSanctumState.Instance.TalkedToAirshipGuy = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts.Player
|
||||
{
|
||||
public class TalkedToFrogLady : MonoBehaviour
|
||||
{
|
||||
private InputAction confirmAction;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
confirmAction = new InputAction("confirm", binding: "<Keyboard>/x");
|
||||
confirmAction.AddBinding("<GamePad>/buttonSouth");
|
||||
confirmAction.Enable();
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
confirmAction.Disable();
|
||||
}
|
||||
|
||||
public void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (Input.GetButton(InputOptions.Submit))
|
||||
if (confirmAction.triggered)
|
||||
UnlockSanctumState.Instance.TalkedToFrog = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts.Player
|
||||
{
|
||||
public class TalkedToIceGuy : MonoBehaviour
|
||||
{
|
||||
private InputAction confirmAction;
|
||||
|
||||
void Start()
|
||||
{
|
||||
confirmAction = new InputAction("confirm", binding: "<Keyboard>/x");
|
||||
confirmAction.AddBinding("<GamePad>/buttonSouth");
|
||||
confirmAction.Enable();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
confirmAction.Disable();
|
||||
}
|
||||
|
||||
public void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (Input.GetButton(InputOptions.Submit))
|
||||
if (confirmAction.triggered)
|
||||
UnlockSanctumState.Instance.TalkedToIceGuy = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,28 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts.Player
|
||||
{
|
||||
public class TalkedToVoid : MonoBehaviour
|
||||
{
|
||||
private InputAction confirmAction;
|
||||
|
||||
void Start()
|
||||
{
|
||||
confirmAction = new InputAction("confirm", binding: "<Keyboard>/x");
|
||||
confirmAction.AddBinding("<GamePad>/buttonSouth");
|
||||
confirmAction.Enable();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
confirmAction.Disable();
|
||||
}
|
||||
|
||||
public void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
if (Input.GetButton(InputOptions.Submit))
|
||||
UnlockSanctumState.Instance.VoidOpened = true;
|
||||
}
|
||||
if (confirmAction.triggered)
|
||||
UnlockSanctumState.Instance.VoidOpened = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Scampz.GameJam.Assets.Scripts;
|
||||
using Scampz.GameJam.Assets.Scripts.Audio;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
@@ -16,6 +16,20 @@ namespace Scampz.GameJam
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI _promptText;
|
||||
|
||||
private InputAction confirmAction;
|
||||
|
||||
void Start()
|
||||
{
|
||||
confirmAction = new InputAction("confirm", binding: "<Keyboard>/x");
|
||||
confirmAction.AddBinding("<GamePad>/buttonSouth");
|
||||
confirmAction.Enable();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
confirmAction.Disable();
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider collider)
|
||||
{
|
||||
if (!_loaded && collider.CompareTag("Player"))
|
||||
@@ -30,7 +44,7 @@ namespace Scampz.GameJam
|
||||
|
||||
private void OnTriggerStay(Collider collider)
|
||||
{
|
||||
if (!_loaded && collider.CompareTag("Player") && _promptText != null && _promptText.enabled && Input.GetButton(InputOptions.Submit))
|
||||
if (!_loaded && collider.CompareTag("Player") && _promptText != null && _promptText.enabled && confirmAction.IsPressed())
|
||||
LoadNextLevel();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
using Scampz.GameJam.Assets.Scripts;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
public class TitleScreen : MonoBehaviour
|
||||
{
|
||||
private InputAction confirmAction;
|
||||
|
||||
void Start()
|
||||
{
|
||||
confirmAction = new InputAction("confirm", binding: "<Keyboard>/x");
|
||||
confirmAction.AddBinding("<GamePad>/buttonSouth");
|
||||
confirmAction.Enable();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetButton(InputOptions.Submit))
|
||||
if (confirmAction.triggered)
|
||||
GameManager.Instance.LoadScene(SceneNames.WorldMap, LoadSceneMode.Single);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts.Utilities
|
||||
{
|
||||
public class WaitForKeyDown : CustomYieldInstruction
|
||||
{
|
||||
private List<string> _inputOptions;
|
||||
private InputAction _inputAction;
|
||||
|
||||
public override bool keepWaiting => !ShouldContinue();
|
||||
|
||||
public WaitForKeyDown(params string[] inputOptions)
|
||||
public WaitForKeyDown(InputAction inputAction)
|
||||
{
|
||||
_inputOptions = inputOptions.ToList();
|
||||
_inputAction = inputAction;
|
||||
}
|
||||
|
||||
private bool ShouldContinue()
|
||||
{
|
||||
foreach (var input in _inputOptions)
|
||||
{
|
||||
if (Input.GetButtonDown(input))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return _inputAction.triggered;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user