Entity.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Axiom.MathLib;
  5. using OpenSim.types;
  6. using libsecondlife;
  7. namespace OpenSim.world
  8. {
  9. public class Entity
  10. {
  11. protected libsecondlife.LLUUID uuid;
  12. protected uint localid;
  13. public LLVector3 position;
  14. public LLVector3 velocity;
  15. public Quaternion rotation;
  16. protected string name;
  17. protected List<Entity> children;
  18. public Entity()
  19. {
  20. uuid = new libsecondlife.LLUUID();
  21. localid = 8880000 + (OpenSim_Main.local_world._localNumber++); // FIXME - race condition!
  22. position = new LLVector3();
  23. velocity = new LLVector3();
  24. rotation = new Quaternion();
  25. name = "(basic entity)";
  26. children = new List<Entity>();
  27. }
  28. public virtual void addFroces()
  29. {
  30. foreach (Entity child in children)
  31. {
  32. child.addFroces();
  33. }
  34. }
  35. public virtual void update() {
  36. // Do any per-frame updates needed that are applicable to every type of entity
  37. foreach (Entity child in children)
  38. {
  39. child.update();
  40. }
  41. }
  42. public virtual string getName()
  43. {
  44. return name;
  45. }
  46. public virtual Mesh getMesh()
  47. {
  48. Mesh mesh = new Mesh();
  49. foreach (Entity child in children)
  50. {
  51. mesh += child.getMesh();
  52. }
  53. return mesh;
  54. }
  55. }
  56. }