unitinfo.InitialFacing etc
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRa.Game
|
||||
@@ -47,8 +46,7 @@ namespace OpenRa.Game
|
||||
|
||||
public void GiveCash( int num )
|
||||
{
|
||||
// TODO: increase cash
|
||||
Cash += num; // TODO: slowly
|
||||
Cash += num;
|
||||
}
|
||||
|
||||
public bool TakeCash( int num )
|
||||
@@ -97,45 +95,4 @@ namespace OpenRa.Game
|
||||
production[ group ] = item;
|
||||
}
|
||||
}
|
||||
|
||||
class ProductionItem
|
||||
{
|
||||
public readonly string Item;
|
||||
|
||||
public readonly int TotalTime;
|
||||
public readonly int TotalCost;
|
||||
public int RemainingTime { get; private set; }
|
||||
public int RemainingCost { get; private set; }
|
||||
|
||||
public bool Paused = false, Done = false;
|
||||
public Action OnComplete;
|
||||
|
||||
public ProductionItem( string item, int time, int cost, Action onComplete )
|
||||
{
|
||||
Item = item;
|
||||
RemainingTime = TotalTime = time;
|
||||
RemainingCost = TotalCost = cost;
|
||||
OnComplete = onComplete;
|
||||
}
|
||||
|
||||
public void Tick( Player player )
|
||||
{
|
||||
if (Done)
|
||||
{
|
||||
if (OnComplete != null) OnComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
if( Paused ) return;
|
||||
|
||||
var costThisFrame = RemainingCost / RemainingTime;
|
||||
if( costThisFrame != 0 && !player.TakeCash( costThisFrame ) ) return;
|
||||
|
||||
RemainingCost -= costThisFrame;
|
||||
RemainingTime -= 1;
|
||||
if( RemainingTime > 0 ) return;
|
||||
|
||||
Done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user