summaryrefslogtreecommitdiff
path: root/tests/union_vector/Character.cs
blob: cb16e6f85cbe158b49f8f2c488ca9592359e9d95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// <auto-generated>
//  automatically generated by the FlatBuffers compiler, do not modify
// </auto-generated>

public enum Character : byte
{
  NONE = 0,
  MuLan = 1,
  Rapunzel = 2,
  Belle = 3,
  BookFan = 4,
  Other = 5,
  Unused = 6,
};

public class CharacterUnion {
  public Character Type { get; set; }
  public object Value { get; set; }

  public CharacterUnion() {
    this.Type = Character.NONE;
    this.Value = null;
  }

  public T As<T>() where T : class { return this.Value as T; }
  public AttackerT AsMuLan() { return this.As<AttackerT>(); }
  public RapunzelT AsRapunzel() { return this.As<RapunzelT>(); }
  public BookReaderT AsBelle() { return this.As<BookReaderT>(); }
  public BookReaderT AsBookFan() { return this.As<BookReaderT>(); }
  public string AsOther() { return this.As<string>(); }
  public string AsUnused() { return this.As<string>(); }

  public static int Pack(FlatBuffers.FlatBufferBuilder builder, CharacterUnion _o) {
    switch (_o.Type) {
      default: return 0;
      case Character.MuLan: return Attacker.Pack(builder, _o.AsMuLan()).Value;
      case Character.Rapunzel: return Rapunzel.Pack(builder, _o.AsRapunzel()).Value;
      case Character.Belle: return BookReader.Pack(builder, _o.AsBelle()).Value;
      case Character.BookFan: return BookReader.Pack(builder, _o.AsBookFan()).Value;
      case Character.Other: return builder.CreateString(_o.AsOther()).Value;
      case Character.Unused: return builder.CreateString(_o.AsUnused()).Value;
    }
  }
}