You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
568 B

  1. use serde::{Deserialize, Serialize};
  2. use specs::{Component, HashMapStorage};
  3. use crate::misc::FlaggedStorage;
  4. #[derive(Clone, Debug, Serialize, Deserialize)]
  5. pub struct Asteroid {
  6. type_: Type,
  7. }
  8. #[derive(Copy, Clone, Debug, Serialize, Deserialize)]
  9. pub enum Type {
  10. Metal,
  11. Crystal,
  12. }
  13. impl Asteroid {
  14. #[inline]
  15. pub fn new(type_: Type) -> Self {
  16. Self { type_ }
  17. }
  18. #[inline]
  19. pub fn type_(&self) -> Type {
  20. self.type_
  21. }
  22. }
  23. impl Component for Asteroid {
  24. type Storage = FlaggedStorage<Self, HashMapStorage<Self>>;
  25. }