Example #1
0
 /// <summary>
 /// Creates a unit of given entry at given position with given owner
 /// </summary>
 /// <param id="entry">Db entry of the unit</param>
 /// <param id="position">Position if the unit</param>
 /// <param id="owner">Owner of the unit</param>
 /// <returns>The created unit</returns>
 public IScriptUnit CreateUnit(IScriptDbEntry entry, Vector2 position, IScriptPlayer owner)
 {
   Unit u = new Unit();
   u.Initialize((EntryDb)entry, this, (Player)owner, position);
   u.InitializeGraphics();
   u.CancelOrders();
   SendData(Network.MakeServerMessage(MessageType.GameObjCreate, u));
   return u;
 }
Example #2
0
 /// <summary>
 /// Will spawn a new unit
 /// </summary>
 public override void Step()
 {
   if (spawner.Health == 0 || spawner.Removed)
   {
     Active = false;
   }
   else if (game.IsServer)
   {
     Unit u = new Unit();
     u.Initialize(Spawnee, game, owner, spawnPoint);
     u.InitializeGraphics();
     u.CancelOrders();
     game.SendData(Network.MakeServerMessage(MessageType.GameObjCreate, u));
   }
   base.Step();
 }