2 using Microsoft.Xna.Framework;
4 using System.Collections.Generic;
5 using System.Collections.Immutable;
7 using System.Reflection;
16 private readonly ConstructorInfo constructor;
20 ConstructorInfo constructor,
21 bool resizeHorizontal =
false,
22 bool resizeVertical =
false,
23 bool linkable =
false,
24 IEnumerable<Identifier> allowedLinks =
null,
25 IEnumerable<string> aliases =
null)
28 System.Diagnostics.Debug.Assert(constructor !=
null);
29 this.constructor = constructor;
30 this.
Name = TextManager.Get($
"EntityName.{identifier}");
31 this.
Description = TextManager.Get($
"EntityDescription.{identifier}");
36 this.
Aliases = (aliases ?? Enumerable.Empty<
string>()).Concat(identifier.Value.ToEnumerable()).ToImmutableHashSet();
47 "hull".ToIdentifier(),
48 typeof(
Hull).GetConstructor(
new Type[] { typeof(
Rectangle) }),
49 resizeHorizontal:
true,
52 allowedLinks:
new Identifier[] {
"hull".ToIdentifier() });
57 typeof(
Gap).GetConstructor(
new Type[] { typeof(
Rectangle) }),
58 resizeHorizontal:
true,
59 resizeVertical:
true);
63 "waypoint".ToIdentifier(),
68 "spawnpoint".ToIdentifier(),
77 object[] lobject =
new object[] {
this, rect };
78 constructor.Invoke(lobject);
82 object[] lobject =
new object[] { rect };
83 constructor.Invoke(lobject);
94 public override ImmutableHashSet<Identifier>
Tags {
get; } = Enumerable.Empty<
Identifier>().ToImmutableHashSet();
100 public override ImmutableHashSet<string>
Aliases {
get; }
104 throw new InvalidOperationException(
105 $
"{nameof(CoreEntityPrefab)}.{nameof(Dispose)} should never be called");
static readonly PrefabCollection< CoreEntityPrefab > Prefabs
override ImmutableHashSet< Identifier > AllowedLinks
static CoreEntityPrefab SpawnPointPrefab
static CoreEntityPrefab GapPrefab
static void InitCorePrefabs()
override LocalizedString Name
static CoreEntityPrefab HullPrefab
override MapEntityCategory Category
static CoreEntityPrefab WayPointPrefab
override ImmutableHashSet< Identifier > Tags
override void CreateInstance(Rectangle rect)
override string OriginalName
override ImmutableHashSet< string > Aliases
LocalizedString Description
readonly Identifier Identifier