Look at the line _blockMinedFrame = 5;
public override void Update(float dt)
{
base.Update(dt);
if (_currentBlockMining != null)
if (_currentBlockMining.Value.Worldlocation == _blockMining.Worldlocation)
{
_timeMining += dt;
float frameCurrent = _timeMining / _timeTillMiningCompleate;
frameCurrent *= 7;
frameCurrent--;
_blockMinedFrame = 5;
if (_timeMining >= _timeTillMiningCompleate)
{
MineBlock();
}
}
else
{
_blockMining = _currentBlockMining.Value;
_timeTillMiningCompleate = Block.LookupBlock(_blockMining.Id).Strenght;
_timeMining = 0;
}
_currentBlockMining = null;
}
The line runs fine and sets the variable to 5, but the next time the update is called the variable is reset to -5;
here is how I call it
for (int i = 0; i < Mobs.Count; i++)
{
Mobs[i].Update(dt); //update each mob
}
the weird thing is the other variables keep there state. No other places calls or sets this
variable. I even changed it to a property and put a break point on the set function and the only set is the one that I run.
I’m so confused right now, probably missing something really obvious.
Thanks guys