500 lines
13 KiB
C#
500 lines
13 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.NativeInterop;
|
|
|
|
[ScriptPath("res://Scripts/Events/IntroClassRoom.cs")]
|
|
public partial class IntroClassRoom : Node2D, IEvent
|
|
{
|
|
[Export(PropertyHint.None, "")]
|
|
private Entity kanako;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Entity june;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Sprite2D door;
|
|
|
|
public static IEnumerator FirstEvent()
|
|
{
|
|
Room.LoadRoom(Room.IDs.SchoolMain);
|
|
yield return null;
|
|
Room.current.DoMusic();
|
|
MainMenu.SetPlayer();
|
|
yield return null;
|
|
Entity cole = Player.instance;
|
|
Entity kanako = Room.NewEntity(Entity.IDs.Kanako, new Vector2(18f, -4f));
|
|
cole.GlobalPosition = new Vector2(-9f, -4f);
|
|
yield return null;
|
|
cole.anim.Play("Jumped");
|
|
kanako.LookAt(cole.GlobalPosition);
|
|
yield return null;
|
|
cole.anim.Stop();
|
|
CameraController.instance.cover.Visible = false;
|
|
CameraController.instance.shakeTime = 30f;
|
|
TextSystem.GetText("KanakoIntro1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
Node n = cole.Emoticon(Entity.Emoticons.Exclaim);
|
|
Audio.PlaySound("snd_b.wav");
|
|
while (GodotObject.IsInstanceValid(n))
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
cole.anim.Play("NorthIdle");
|
|
Audio.PlaySound("snd_wing_ch1.wav");
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
cole.LookAt(kanako.GlobalPosition);
|
|
Audio.PlaySound("snd_wing_ch1.wav");
|
|
cole.UpdateAnim(force: true);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntro2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntro3");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.direction = Entity.Direction.South;
|
|
kanako.UpdateAnim(force: true);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.LookAt(cole.GlobalPosition);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntro4");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
cole.LookAt(cole.GlobalPosition + Vector2.Up);
|
|
kanako.DoAutoMove(new Vector2[3]
|
|
{
|
|
new Vector2(18f, -87f),
|
|
new Vector2(-86f, -87f),
|
|
new Vector2(-86f, -129f)
|
|
});
|
|
while (kanako.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_dooropen_ch1.wav");
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_doorclose_ch1.wav");
|
|
kanako.QueueFree();
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
cole.direction = Entity.Direction.South;
|
|
cole.UpdateAnim(force: true);
|
|
Player.instance.canInput = true;
|
|
}
|
|
|
|
public void StartCorridorEvent()
|
|
{
|
|
Player.instance.StopMoving();
|
|
Main.inEvent = Coroutine.Start(CorridorEvent());
|
|
}
|
|
|
|
public IEnumerator CorridorEvent()
|
|
{
|
|
SaveFile.AddFlag(SaveFile.Flags.IntroEvent);
|
|
Player.instance.LookAt(kanako.GlobalPosition);
|
|
TextSystem.GetText("KanakoIntroCorridor1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.LookAt(Player.instance.Position);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.DoAutoMove(new Vector2(-868f, kanako.GlobalPosition.Y));
|
|
Player.instance.DoAutoMove(new Vector2(-825f, Player.instance.GlobalPosition.Y), 0.8f);
|
|
while (kanako.moving != null || Player.instance.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor3");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.LookAt(Player.instance.GlobalPosition);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor4");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (TextSystem.lastPrompt == 0)
|
|
{
|
|
TextSystem.GetText("KanakoIntroCorridor5");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.anim.Play("SadSide");
|
|
for (float a = 0f; a < 180f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.UpdateAnim(force: true);
|
|
for (float a = 0f; a < 50f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("KanakoIntroCorridor6");
|
|
}
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor7");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (TextSystem.lastPrompt == 0)
|
|
{
|
|
SaveFile.current.values[0]++;
|
|
}
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor8");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.DoAutoMove(Player.instance.GlobalPosition + Vector2.Left * 50f, 0.5f);
|
|
kanako.DoAutoMove(kanako.GlobalPosition + Vector2.Left * 50f, 0.5f);
|
|
june.DoAutoMove(new Vector2(-965f, june.GlobalPosition.Y), 0.35f);
|
|
while (Player.instance.moving != null || kanako.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
Node n = kanako.Emoticon(Entity.Emoticons.Exclaim, sound: true);
|
|
while (GodotObject.IsInstanceValid(n) || june.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor9");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
june.DoAutoMove(new Vector2[2]
|
|
{
|
|
new Vector2(-900f, june.GlobalPosition.Y),
|
|
new Vector2(-900f, 120f)
|
|
}, 0.75f);
|
|
kanako.DoAutoMove(new Vector2(kanako.GlobalPosition.X, -69f), 0.5f);
|
|
kanako.moving.doFacing = false;
|
|
kanako.direction = Entity.Direction.South;
|
|
while (june.moving != null)
|
|
{
|
|
Player.instance.LookAt(june.GlobalPosition);
|
|
kanako.LookAt(june.GlobalPosition);
|
|
yield return null;
|
|
}
|
|
kanako.DoAutoMove(new Vector2(kanako.GlobalPosition.X, -52f), 0.5f);
|
|
while (kanako.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.LookAt(Player.instance.GlobalPosition);
|
|
Player.instance.LookAt(kanako.GlobalPosition);
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor10");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.DoAutoMove(new Vector2[2]
|
|
{
|
|
new Vector2(-1110f, kanako.GlobalPosition.Y),
|
|
new Vector2(-1110f, -100f)
|
|
}, 1.1f);
|
|
Player.instance.DoAutoMove(new Vector2[2]
|
|
{
|
|
new Vector2(Player.instance.GlobalPosition.X, -52f),
|
|
new Vector2(-1110f, -52f)
|
|
}, 0.9f);
|
|
while (kanako.moving != null || Player.instance.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.LookAt(kanako.GlobalPosition);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.LookAt(Player.instance.GlobalPosition);
|
|
CameraController.instance.follow = null;
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Coroutine p = Coroutine.Start(Common.Move(CameraController.instance, CameraController.instance.GlobalPosition + Vector2.Up * 40f, 100f));
|
|
while (!p.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor11");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.direction = Entity.Direction.North;
|
|
kanako.UpdateAnim(force: true);
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
door.Visible = true;
|
|
Audio.PlaySound("snd_impact_ch1.wav");
|
|
Node2D dark = door.GetChild<Node2D>(0);
|
|
for (float a = 0f; a < 100f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Color d = new Color(0.35f, 0.35f, 0.65f);
|
|
Room.current.DoMusic(1);
|
|
for (float a = 0f; a < 300f; a += Main.deltaTime)
|
|
{
|
|
dark.Modulate = Main.colorClear.Lerp(Main.colorWhite, a / 300f);
|
|
Room.current.tileMap.SetLayerModulate(0, Main.colorWhite.Lerp(d, a / 300f));
|
|
Room.current.tileMap.SetLayerModulate(1, Main.colorWhite.Lerp(d, a / 300f));
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor12");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 120f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.DoAutoMove(new Vector2(-1110f, -113f), 0.25f);
|
|
while (kanako.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 120f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor13");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 120f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
kanako.direction = Entity.Direction.South;
|
|
kanako.UpdateAnim(force: true);
|
|
for (float a = 0f; a < 120f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor14");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.ChangeMusic(null);
|
|
AnimatedSprite2D dooranim = door.GetChild<AnimatedSprite2D>(1);
|
|
dooranim.Visible = true;
|
|
dooranim.Play("Anim0");
|
|
Audio.PlaySound("snd_whistlebreath_ch1.wav", 1f, 0.9f);
|
|
n = Player.instance.Emoticon(Entity.Emoticons.Exclaim);
|
|
while (GodotObject.IsInstanceValid(n))
|
|
{
|
|
yield return null;
|
|
}
|
|
n = kanako.Emoticon(Entity.Emoticons.Question);
|
|
while (GodotObject.IsInstanceValid(n))
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoIntroCorridor15");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
dooranim.Play("Anim1");
|
|
for (float a = 0f; a < 20f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_grab.wav");
|
|
Room.current.DoMusic(2);
|
|
Main.SetActive(kanako, state: false);
|
|
CameraController.instance.shakeTime = 15f;
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
dooranim.Play("Anim2");
|
|
TextSystem.GetText("KanakoIntroCorridor16");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
dooranim.Play("Anim3");
|
|
Audio.PlaySound("snd_noelle_scared.wav", 1f, 0.8f);
|
|
TextSystem.GetText("KanakoIntroCorridor17");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
dooranim.Visible = false;
|
|
Player.instance.DoAutoMove(new Vector2(Player.instance.GlobalPosition.X, -110f), 1.65f);
|
|
Player.instance.moving.doFacing = false;
|
|
while (Player.instance.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 10f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.currentAnim = Entity.Animations.ReadyJump;
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.Shake(60f, 3f);
|
|
Vector2 pp = Player.instance.GlobalPosition;
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
Player.instance.GlobalPosition = pp.Lerp(pp + Vector2.Down * 20f, a / 60f);
|
|
yield return null;
|
|
}
|
|
Player.instance.currentAnim = Entity.Animations.Jumped;
|
|
pp = Player.instance.GlobalPosition;
|
|
Player.instance.collider.Disabled = true;
|
|
Player.instance.ZIndex = 3000;
|
|
door.ZIndex = 2900;
|
|
Audio.ChangeMusic(null);
|
|
Audio.PlaySound("snd_fountain_make.ogg");
|
|
for (float a = 0f; a < 100f; a += Main.deltaTime)
|
|
{
|
|
door.Scale = Vector2.One.Lerp(Vector2.One * 10f, a / 60f);
|
|
door.Rotation = Mathf.LerpAngle(0f, Mathf.DegToRad(5f), a / 100f);
|
|
Player.instance.GlobalPosition = pp.Lerp(door.GlobalPosition + Vector2.Up * 30f, Mathf.SmoothStep(0f, 1f, a / 100f));
|
|
yield return null;
|
|
}
|
|
pp = Player.instance.GlobalPosition;
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 300f; a += Main.deltaTime)
|
|
{
|
|
Player.instance.GlobalPosition = pp.Lerp(CameraController.instance.GlobalPosition + Vector2.Down * 400f, Mathf.SmoothStep(0f, 1f, a / 300f));
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 300f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
CameraController.Transition(Main.colorBlack);
|
|
yield return null;
|
|
Room.LoadRoom(Room.IDs.SchoolDWEntrance, reparent: true);
|
|
yield return null;
|
|
Room.current.DoMusic(1);
|
|
Main.inEvent = Coroutine.Start(SchoolDWEvents.FirstEvent());
|
|
}
|
|
|
|
}
|