private static CharacterBehavior CreateCharacterBehaviorFromMember(Member member) { Requires.NotNull(member, nameof(member)); switch (member.GetClass()) { case Class.Gunner: { return new GunnerBehavior(member); } } throw new NotImplementedException(); }
internal static Entity CreateCharacter(Member member) { Requires.NotNull(member, nameof(member)); return new Entity() { Tag = Constants.Tags.Member } .AddComponent(new RectangleCollider()) .AddComponent(new Transform2D() { XScale = 3, YScale = 3, }) .AddComponent(new SpriteRenderer(DefaultLayers.Alpha, samplerMode: AddressMode.PointClamp)) .AddComponent(new Sprite(ClassToSpritePath[member.GetClass()])) .AddComponent(CreateCharacterBehaviorFromMember(member)); }