-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
6,301 additions
and
861 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Microsoft.Xna.Framework; | ||
|
||
namespace Celeste.Mod.Entities { | ||
/// <summary> | ||
/// A trigger to change the current ambience track. | ||
/// | ||
/// Attributes: | ||
/// - `track`: the audio event to set the ambience to | ||
/// - `resetOnLeave`: if true, remembers what the ambience was before entering the trigger, and restores it after leaving | ||
/// </summary> | ||
[CustomEntity("everest/ambienceTrigger", "Sardine7/AmbienceTrigger")] | ||
public class AmbienceTrigger : Trigger { | ||
|
||
private string Track; | ||
private bool ResetOnLeave; | ||
|
||
private string oldTrack; | ||
|
||
public AmbienceTrigger(EntityData data, Vector2 offset) : base(data, offset) { | ||
Track = data.Attr("track"); | ||
ResetOnLeave = data.Bool("resetOnLeave", defaultValue: false); | ||
} | ||
|
||
public override void OnEnter(Player player) { | ||
if (ResetOnLeave) { | ||
oldTrack = Audio.GetEventName(Audio.CurrentAmbienceEventInstance); | ||
} | ||
|
||
Session session = SceneAs<Level>().Session; | ||
session.Audio.Ambience.Event = SFX.EventnameByHandle(Track); | ||
session.Audio.Apply(); | ||
} | ||
|
||
public override void OnLeave(Player player) { | ||
if (ResetOnLeave) { | ||
Session session = SceneAs<Level>().Session; | ||
session.Audio.Ambience.Event = oldTrack; | ||
session.Audio.Apply(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Microsoft.Xna.Framework; | ||
using Monocle; | ||
|
||
namespace Celeste.Mod.Entities { | ||
/// <summary> | ||
/// A trigger to change the volume of the current ambience track. | ||
/// </summary> | ||
[CustomEntity("everest/ambienceVolumeTrigger", "MaxHelpingHand/AmbienceVolumeTrigger")] | ||
public class AmbienceVolumeTrigger : Trigger { | ||
|
||
private float from; | ||
private float to; | ||
private PositionModes positionMode; | ||
|
||
public AmbienceVolumeTrigger(EntityData data, Vector2 offset) : base(data, offset) { | ||
from = data.Float("from"); | ||
to = data.Float("to"); | ||
positionMode = data.Enum("direction", PositionModes.NoEffect); | ||
} | ||
|
||
public override void OnStay(Player player) { | ||
float ambienceVolume = Calc.ClampedMap(GetPositionLerp(player, positionMode), 0f, 1f, from, to); | ||
((patch_AudioState) SceneAs<Level>().Session.Audio).AmbienceVolume = ambienceVolume; | ||
Audio.CurrentAmbienceEventInstance?.setVolume(ambienceVolume); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.