The file defines a static class used to construct the visual front facade for a bank location. It loads required materials and models to create blocks and labels on the map.
namespace HorizonRP;
/// <summary>Habillage réversible de l'agence Truenorth : aucun changement de la map,
/// des murs, des portes ni des transactions. Bandeau solide, construit avec la carte.</summary>
public static class BankFacade
{
public static void Build( GameObject map )
{
var root = new GameObject( map, true, "HZ BANK · façade" );
root.Flags |= GameObjectFlags.NotNetworked | GameObjectFlags.NotSaved;
var navy = Material.Load( "materials/horizon/bank_navy.vmat" );
var stone = Material.Load( "materials/horizon/bank_stone.vmat" );
var red = Material.Load( "materials/horizon/bank_red.vmat" );
var box = Model.Load( "models/dev/box.vmdl" );
GameObject Block( string name, Vector3 position, Vector3 size, Material material )
{
var go = new GameObject( root, true, name );
go.Flags |= GameObjectFlags.NotNetworked | GameObjectFlags.NotSaved;
go.LocalPosition = position;
go.LocalScale = size / 50f;
var r = go.Components.Create<ModelRenderer>();
r.Model = box;
r.MaterialOverride = material;
var collider = go.Components.Create<BoxCollider>();
collider.Scale = new Vector3( 50, 50, 50 );
collider.Static = true;
return go;
}
void Label( string text, Vector3 position, float size, int weight = 600 )
{
if ( Application.IsDedicatedServer ) return;
var go = new GameObject( root, true, text );
go.Flags |= GameObjectFlags.NotNetworked | GameObjectFlags.NotSaved;
go.LocalPosition = position;
go.LocalRotation = Rotation.FromYaw( -90 );
var t = go.Components.Create<TextRenderer>();
t.Text = text;
t.FontFamily = "Inter";
t.FontSize = 64;
t.FontWeight = weight;
t.Scale = size / 64f;
t.Color = Color.White;
t.HorizontalAlignment = TextRenderer.HAlignment.Center;
t.VerticalAlignment = TextRenderer.VAlignment.Center;
t.Billboard = TextRenderer.BillboardMode.None;
}
// Bandeau sous la corniche, au-dessus de toutes les fenêtres existantes.
Block( "Bandeau agence", new( 6600, 2951, 198 ), new( 1080, 14, 68 ), navy );
Block( "Couronnement clair", new( 6600, 2953, 234 ), new( 1092, 20, 6 ), stone );
Block( "Signature rouge", new( 6600, 2960, 164 ), new( 1080, 3, 4 ), red );
Block( "Emblème HZ", new( 6780, 2960, 201 ), new( 57, 4, 48 ), red );
Label( "HZ", new( 6780, 2963, 201 ), 31, 800 );
Label( "BANK", new( 6647, 2960, 203 ), 42, 700 );
Label( "AGENCE CENTRALE", new( 6395, 2960, 205 ), 18 );
Label( "ÉPARGNE · CONSEIL · FINANCEMENT", new( 6395, 2960, 183 ), 9 );
}
}