monster_step_7.fbs (397B)
1 enum Color:byte { red, green, blue } 2 3 union Equipment { Weapon } // Optionally add more tables. 4 5 struct Vec3 { 6 x:float; 7 y:float; 8 } 9 10 table Monster { 11 pos:Vec3; 12 color:Color = Blue; 13 14 mana:short = 150; 15 hp:short = 100; 16 name:string; 17 equipped:Equipment; 18 weapons:[Weapon]; 19 path:[Vec3]; 20 } 21 22 table Weapon { 23 name:string; 24 damage:short; 25 } 26 27 root_type Monster; // flatc --swift monster.fbs