Skip to content

Commit

Permalink
Added main menu and intro cinematic. Added brief pause on punctuation…
Browse files Browse the repository at this point in the history
… to dialogue animations.

SFX_Player_Talk_1 was changed to remove a pop at the end of the audio.
  • Loading branch information
PathogenDavid committed Sep 23, 2024
1 parent dce2435 commit 1b1d811
Show file tree
Hide file tree
Showing 21 changed files with 4,869 additions and 560 deletions.
Binary file added Assets/HandMadeGame/Art/2D/IntroPanel_UI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 127 additions & 0 deletions Assets/HandMadeGame/Art/2D/IntroPanel_UI.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/HandMadeGame/Art/2D/keyboard_e_black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 127 additions & 0 deletions Assets/HandMadeGame/Art/2D/keyboard_e_black.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,916 changes: 2,370 additions & 546 deletions Assets/HandMadeGame/Art/Fonts/Birdgo SDF.asset

Large diffs are not rendered by default.

Binary file modified Assets/HandMadeGame/Audio/SFX_Player_Talk_1.wav
Binary file not shown.
Binary file added Assets/HandMadeGame/Audio/SFX_TreeRustle.wav
Binary file not shown.
23 changes: 23 additions & 0 deletions Assets/HandMadeGame/Audio/SFX_TreeRustle.wav.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/HandMadeGame/Audio/SFX_TreeRustle2.wav
Binary file not shown.
23 changes: 23 additions & 0 deletions Assets/HandMadeGame/Audio/SFX_TreeRustle2.wav.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions Assets/HandMadeGame/Code/BirdFlyInAnimation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using UnityEngine;

public sealed class BirdFlyInAnimation : MonoBehaviour
{
public Transform Visuals;
public Transform Destination;

public FollowPlayer CameraController;

private Vector3 Velocity = Vector3.zero;
public float PositionSmoothing = 0.15f;
public float OrientationSmoothing = 2f;

private float TotalDistance;
private Action FinishAction;

public float CameraEnableDistancePercent = 0.9f;

public AudioClip TreeRustleSound;
public float TreeRustleTimer = 0.1f;

public void StartAnimation(Action finishAction)
{
enabled = true;
TotalDistance = (Destination.position - transform.position).magnitude;
FinishAction = finishAction;
}

private void Update()
{
if (TreeRustleTimer > 0f)
{
TreeRustleTimer -= Time.deltaTime;
if (TreeRustleTimer <= 0f)
SoundEffectsController.Instance.PlayUiSound(TreeRustleSound); //TODO: Don't use UI sounds for this
}

transform.position = Vector3.SmoothDamp(transform.position, Destination.position, ref Velocity, PositionSmoothing);
Visuals.rotation = Quaternion.Slerp(Visuals.rotation, Destination.rotation, OrientationSmoothing * Time.deltaTime);

float distanceRemaining = (Destination.position - transform.position).magnitude;
if (distanceRemaining < TotalDistance * (1f - CameraEnableDistancePercent) && !CameraController.enabled)
{
CameraController.enabled = true;
}
else if (distanceRemaining < 0.01f)
{
CameraController.enabled = true;
FinishAction?.Invoke();
enabled = false;
}
}
}
11 changes: 11 additions & 0 deletions Assets/HandMadeGame/Code/BirdFlyInAnimation.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions Assets/HandMadeGame/Code/DialogueController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public sealed class DialogueController : MonoBehaviour
public InventoryHotBarController InventoryHotBar;

public float SecondsPerCharacter = 0.01f;
public float PunctuationPause = 0.2f;
public float CharacterTimer = 0f;
public int RemainingCharacterCount;
private bool IsAnimating => RemainingCharacterCount > 0;
Expand Down Expand Up @@ -141,10 +142,14 @@ private void Update()
CharacterTimer -= Time.deltaTime;
if (CharacterTimer < 0f)
{
CharacterTimer = SecondsPerCharacter;
bool isPunctuation = DialogueText.textInfo.characterInfo[DialogueText.maxVisibleCharacters].character is '.' or '!' or '?';
CharacterTimer = isPunctuation ? PunctuationPause : SecondsPerCharacter;

RemainingCharacterCount--;
DialogueText.maxVisibleCharacters++;
SoundEffectsController.Instance.PlayChirp(ChirpRandomness, ChirpFont);

if (!isPunctuation)
SoundEffectsController.Instance.PlayChirp(ChirpRandomness, ChirpFont);
}

// Allow skipping the animation
Expand Down
Loading

0 comments on commit 1b1d811

Please sign in to comment.