public World World; //what world am i in #endregion Fields #region Constructors public SpaceObject(World _world) { World = _world; Visible = true; Tags = new List<string>(); Health = 1; MaxHealth = 1; }
public Station( World _world ) : base(_world) { DockedShips = new List<Ship>(); Hangars = new Dictionary<Ship, List<Item>>(); }
public Asteroid( string _name, World _world ) : base(_name, _world) { Name = "Asteroid"; Texture = Res.Textures["asteroid"]; Size = new Vector2(32, 32); Utility.Untag(this, "item"); Utility.Tag(this, "celestial"); }
public Container( string _name, World _world ) : base(_name, _world) { Name = "Generic Container"; World = _world; Texture = Res.Textures["generic"]; Size = new Vector2(24, 24); Inventory = new List<Item>(); Utility.Tag(this, "item"); Utility.Tag(this, "container"); ID = 100; }
public Ship( Vector2 _position, World _world ) : base(_world) { Name = ShipNameGenerator.GenerateName(); Texture = Res.Textures["ship"]; Position = _position; Size = new Vector2(32, 32); TargetPosition = null; Direction = Math.PI; Speed = 0; MaxSpeed = 3; Acceleration = 0.002f; Components = new List<ShipComponent>(); Shield = new Shield(Game.Random.Next(50, 100), 100); health = maxHealth = 100; Inventory = new List<Item>(); Tags = new List<string>(); Tags.Add("ship"); Visible = true; Depth = 1; EngineTrail = new Particle2() .SetPosition(Vector2.Zero, 4) //velocity is the oddball, going px/s instead of px/t .SetVelocity(Vector2.Zero, 50) .SetFriction(0.05f, 0.03f, 0.01f) .SetColour( new Color(1f,0.4f,0f,1f), new Color(0f,0.4f,0f,1f), new Color(0f,0f,0f,0f)) .SetScale(1.5f, 0.35f, 0f) .SetRotation(0, Math.PI*2f, 0) //add delta variation .SetTexture(Res.Textures["1x1"]) .SetLifeTime(600, 350); }
public Item( string _name, World _world, int _id = -1, bool _inSpace = true, //debuggish, leave for now int _count = 1 ) : base(_world) { Name = _name; World = _world; ID = _id; Count = _count; Carrier = null; Tags = new List<string>(); Tags.Add("Item"); Size = new Vector2(16, 16); rotationDirection = Game.Random.NextDouble() > 0.5f; rotationSpeed = 0.01f + (float)Game.Random.NextDouble() * 0.01f; if (_inSpace) { World.SpaceObjects.Add(this); } }
public override World Generate(World _world) { Faction _f = new Faction("The Rude Dudes"); Faction _aifactionA = new Faction("The Lumberjack Organization"); Faction _aifactionB = new Faction("The Lumberjack Organization B"); Game.PlayerFaction = _f; Faction.SetRelations(_f, _aifactionA, 0f); Faction.SetRelations(_aifactionB, _aifactionA, -1f); Ship _s = new Ship(new Vector2(100, 300), _world); _world.SpaceObjects.Add(_s); _s.AddItem(ItemDatabase.Spawn(_world, ItemDatabase.Items.Find(x => x.ID == 1102))); _s.AddItem(ItemDatabase.Spawn(_world, ItemDatabase.Items.Find(x => x.ID == 1102))); _s.AddItem(ItemDatabase.Spawn(_world, ItemDatabase.Items.Find(x => x.ID == 1102))); _s.AddItem(ItemDatabase.Spawn(_world, //spawn into inventory ItemDatabase.Items.Find(x => x.ID == 1199))); ItemDatabase.Spawn(_world, //spawn into space ItemDatabase.Items.Find(x => x.ID == 1100)) .SetPosition(new Vector2(100, 100)); _s.Faction = _f; AISimpleMiner _AI = new AISimpleMiner(); Game.AIs.Add(_AI); AISimpleFighter _AI2 = new AISimpleFighter(); _AI2.Faction = _aifactionA; Game.AIs.Add(_AI2); AISimpleFighter _AI3 = new AISimpleFighter(); _AI3.Faction = _aifactionB; Game.AIs.Add(_AI3); for (int i = 0; i < 3; i++) { _s = new Ship(new Vector2( (float)Game.Random.NextDouble()*7000, (float)Game.Random.NextDouble()*7000 ), _world ); _world.SpaceObjects.Add(_s); _s.AddItem(ItemDatabase.Spawn(_world, ItemDatabase.Items.Find(x => x.ID == 1101))); _AI2.Fleet.Add(_s); _s.Faction = _aifactionA; _s = new Ship(new Vector2( (float)Game.Random.NextDouble()*7000, (float)Game.Random.NextDouble()*7000 ), _world ); _world.SpaceObjects.Add(_s); _s.AddItem(ItemDatabase.Spawn(_world, ItemDatabase.Items.Find(x => x.ID == 1101))); _AI3.Fleet.Add(_s); _s.Faction = _aifactionB; } _s = new Ship(new Vector2(100, 100), _world); _world.SpaceObjects.Add(_s); _s.AddItem(ItemDatabase.Spawn(_world, ItemDatabase.Items.Find(x => x.ID == 1102))); _s.AddItem(ItemDatabase.Spawn(_world, ItemDatabase.Items.Find(x => x.ID == 1102))); _AI.Fleet.Add(_s); _s.Faction = _aifactionA; Asteroid _a = new Asteroid("Asteroid", _world); _a.Position = new Vector2(400, 400); _a = new Asteroid("Asteroid", _world); _a.Position = new Vector2(0, 80); Container _c = new Container("Generic Container", _world); return _world; }
public static Item Spawn( World _world, ItemTemplate _template ) { Item _i = new Item(_template.Name, _world); _i.ID = _template.ID; _i.Texture = _template.Texture; _i.Tags = new List<string>(_template.Tags); if (_template.Weapon != null) { Weapon _w = new Weapon( _template.Name, _template.ID); _w.Damage = _template.Weapon.Damage; _w.Frequency = _template.Weapon.Frequency; _w.BeamThickness = _template.Weapon.BeamThickness; _w.Range = _template.Weapon.Range; if(Utility.SumColour(_template.Weapon.BeamTint) != 0) _w.BeamTint = _template.Weapon.BeamTint; _w.Item = _i; _i.Component = _w; _i.Component.Item = _i; //reference upwards for the component } return _i; }
public virtual World Generate(World _world) { throw new Exception("Not yet implemented. Use DevWorldGenerator."); }