Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a resource using tile as position
 /// </summary>
 /// <param id="entry">Entry defining the type of this game object</param>
 /// <param id="game">Game this game object is in</param>
 /// <param id="player">Owner of this game object</param>
 /// <param id="mapTiles">Tile where this game object is placed</param>
 public override void Initialize(EntryDb entry, WildmenGame game, Player player, Tile mapTile)
 {
   AssignUID(game);
   this.entry = (ResourceDb)entry;
   this.Amount = this.entry.InitialAmount;
   this.game = game;
   this.Owner = player;
   player.Assign(this);
   this.NearestTile = mapTile;
   this.MapPosition = mapTile.MapPosition;
   this.RecalculatePosition = true;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes this unit
 /// </summary>
 /// <param id="entry">Entry defining the type of this game object</param>
 /// <param id="game">Game this game object is in</param>
 /// <param id="player">Owner of this game object</param>
 /// <param id="mapPosition">Vector where this game object is placed</param>
 public override void Initialize(EntryDb entry, WildmenGame game, Player player, Vector2 mapPosition)
 {
   AssignUID(game);
   Logger.Log(string.Format("Unit #{0} initialized", this.ObjectUID), "Server update");
   player.Assign(this);
   this.State = GameObjectState.Idle;
   this.Order = GameObjectOrder.Idle;
   this.game = game;
   this.Owner = player;
   this.entry = ((UnitDb)entry).Clone();
   this.MapPosition = mapPosition;
   this.RecalculatePosition = true;
   this.IsMovable = true;
   this.Health = this.entry.Health;
 }
Ejemplo n.º 3
0
    /// <summary>
    /// Initializes this instance and claims the tiles
    /// </summary>
    /// <param name="entry">Type of this building</param>
    /// <param name="game">The game this building is in</param>
    /// <param name="player">The owner of this building</param>
    /// <param name="baseTile">The base tile determining the position of this building</param>
    public override void Initialize(EntryDb entry, WildmenGame game, Player player, Tile baseTile)
    {
      AssignUID(game);
      Logger.Log(string.Format("Building #{0} initialized", this.ObjectUID), "Server update");
      player.Assign(this);
      this.game = game;
      this.Owner = player;
      this.entry = (BuildingDb)entry;
      this.NearestTile = baseTile;
      ClaimTiles(baseTile);
      this.MapPosition = baseTile.MapPosition;
      this.RecalculatePosition = true;

      this.Health = this.entry.Health;
      this.Construction = 0;

      if (Construction >= this.entry.ConstructionAmount)
      {
        Completed(false);
      }
    }