Hacker.cs
using Sandbox;
public sealed class Hacker : Component
{
private int achievment_progress = 0;
[Property] TextRenderer tr;
[Property] TextRenderer ap;
/*
press space
go left red
go backward green
go forward green
press space
press forward and backward until achievment unlock
*/
protected override void OnUpdate()
{
ap.Text = $"Achievment progress - {achievment_progress}";
// Log.Info(achievment_progress.ToString());
WorldPosition += Input.AnalogMove;
if (achievment_progress >= 5)
{
if (achievment_progress == 20)
{
tr.Text = "How, You Get this?";
tr.Color = Color.Yellow;
Sandbox.Services.Achievements.Unlock( "howyougetthis" );
}
if ( Input.Pressed("forward") )
{
if (achievment_progress % 2 == 1)
{
achievment_progress ++;
}
else
{
achievment_progress = 0;
}
}
if ( Input.Pressed( "backward" ) )
{
if ( achievment_progress % 2 == 0 )
{
achievment_progress++;
}
else
{
achievment_progress = 0;
}
}
}
if ( Input.Released( "jump" ) )
{
if (achievment_progress == 0 || achievment_progress == 4)
{
achievment_progress++;
}
else
{
achievment_progress = 0;
}
}
if ( WorldPosition.x < 0 )
{
if ( achievment_progress == 1 )
{
achievment_progress++;
}
}
if ( WorldPosition.y < 0 )
{
if ( achievment_progress == 2 )
{
achievment_progress++;
}
}
if ( WorldPosition.y > 0 )
{
if ( achievment_progress == 3 )
{
achievment_progress++;
}
}
}
}