Using the building footprint, the placement overlay is offset from the cursor so the cursor is in the approximate middle of the overlay (not precisely due to overlay snapping to tiles). The tile size (24) was used as a magic number in a lot of places, they have been replaced with Game.CellSize.
26 lines
521 B
C#
26 lines
521 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace OpenRa.Game.Traits
|
|
{
|
|
class Building : ITick
|
|
{
|
|
public Building(Actor self)
|
|
{
|
|
}
|
|
|
|
bool first = true;
|
|
public void Tick(Actor self, Game game, int dt)
|
|
{
|
|
if (first && self.Owner == game.LocalPlayer)
|
|
{
|
|
self.Owner.TechTree.Build(self.unitInfo.Name, true);
|
|
self.CenterLocation = Game.CellSize * (float2)self.Location + 0.5f * self.SelectedSize;
|
|
}
|
|
first = false;
|
|
}
|
|
}
|
|
}
|