Beispiel #1
0
        public override void Update(TimeSpan deltaTime)
        {
            var k = AttachedWorkers <= 0 ? 0 : 1;

            mBuildTime = mBuildTime.Subtract(TimeSpan.FromSeconds(deltaTime.TotalSeconds * MathUtils.Pow(1 + WorkerInvest, AttachedWorkers - 1) * k));
            Progress   = (float)(1 - mBuildTime.TotalSeconds / mFullBuildTime.TotalSeconds);
            Health     = Math.Max(Progress * MaxHealth, 5);

            if (mBuildTime <= TimeSpan.Zero)
            {
                mGame.RemoveObject(ID);
                mCreateBuilding(Position).ContinueWith(t => mGame.PlaceObject(t.Result));
            }
        }