An unofficial collection of APIs used in FreeJam games and mods
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

block_group_entity.rs 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. use crate::techblox::{UnityFloat3, UnityQuaternion, SerializedEntityComponent, SerializedEntityDescriptor, Parsable};
  2. use libfj_parsable_macro_derive::*;
  3. /// Block group entity descriptor.
  4. #[derive(Clone, Copy, Parsable)]
  5. pub struct BlockGroupEntity {
  6. /// Block group identifier
  7. pub saved_block_group_id: SavedBlockGroupIdComponent,
  8. /// Block group location information
  9. pub block_group_transform: BlockGroupTransformEntityComponent,
  10. }
  11. impl BlockGroupEntity {}
  12. impl SerializedEntityDescriptor for BlockGroupEntity {
  13. fn serialized_components() -> u8 {
  14. 2
  15. }
  16. fn components<'a>(&'a self) -> Vec<&'a dyn SerializedEntityComponent> {
  17. vec![&self.saved_block_group_id,
  18. &self.block_group_transform]
  19. }
  20. }
  21. /// Saved block group identifier entity component.
  22. #[derive(Clone, Copy, Parsable)]
  23. pub struct SavedBlockGroupIdComponent {
  24. /// Block group identifier
  25. pub saved_block_group_id: i32,
  26. }
  27. impl SerializedEntityComponent for SavedBlockGroupIdComponent {}
  28. /// Block group entity component for storing position and rotation.
  29. #[derive(Clone, Copy, Parsable)]
  30. pub struct BlockGroupTransformEntityComponent {
  31. /// Block group position
  32. pub block_group_grid_position: UnityFloat3,
  33. /// Block group rotation
  34. pub block_group_grid_rotation: UnityQuaternion,
  35. }
  36. impl SerializedEntityComponent for BlockGroupTransformEntityComponent {}