Skip to content

Instantly share code, notes, and snippets.

@xanathar
Created March 22, 2021 12:54
Show Gist options
  • Save xanathar/17bfbaf4f18dde745d89313e982e1af4 to your computer and use it in GitHub Desktop.
Save xanathar/17bfbaf4f18dde745d89313e982e1af4 to your computer and use it in GitHub Desktop.
Waking Violet first level source code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using API;
using Assets.Code.Anubi.DefPresets;
using UnityEngine;
namespace Assets.Code.Anubi.Levels
{
class A01 : LevelScript
{
protected override string _Cinematics()
{
return "CK";
}
protected override string _Map()
{
return @"
####### #####
#~~~~~#########...#
#.........~.....X.#
#..~...C#~~####...#
##.~~~~~~~~# ##.##
#.####.#### #.#
###.##x...x# #.#
#....#x...x# ##.##
#.#..#x.C.x# #.t.#
#.####x...x# #..K###
#...P#xxxxx# #.*..S#
############ #...###
#####
";
}
public override Vector4 GetZoomPrecompensation()
{
return new Vector4(0, 0, 5, 0);
}
public override string[] _Grimoire()
{
return null;
}
protected override void _PostLoadSpawns()
{
}
protected override void _Spawns()
{
//Spawn('^', Direction.DOWN, "stairs");
Spawn('-', Direction.DOWN, "hdoor");
//var trigger = Spawn('t', Direction.DOWN, "trigger", "trigger") as PressurePlate;
var skel = Spawn('S', Direction.DOWN, "skeleton");
Spawn('K', Direction.DOWN, "crate");
Spawn('x', Direction.DOWN, "mistake_trigger");
Spawn('C', Direction.DOWN, "crate");
Spawn('P', Direction.DOWN, "player", "player");
var exit = Spawn('X', Direction.DOWN, "exit");
Tutorial.AddStep(new Tutorial.Step()
{
HelpText = "|TUT_A01_1",
Timeout = 10
});
((Item)Spawn('*', Direction.DOWN, "hourglass")).OnPickUp = e =>
{
DisableUndoSave();
CineOn(exit, 2f);
Delay(2f, () => { exit.SendMessage(exit, Message.WAKEUP, null); e.PlaySound("chime"); }, LevelTime.Mode.UndoTime);
Delay(4f, () => skel.SendMessage(exit, Message.WAKEUP, null), LevelTime.Mode.UndoTime);
};
if (GameProgress.WasLevelWon("A01"))
Spawn('P', Direction.DOWN, "entrance");
PlateTrigger('t')
.SetOneUse(true)
.OnActivate(e => Tutorial.Next());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment