public void performAction(GameTime time, Unit target) { //base.performAction(); if (elapsedTime.Seconds > ATTACK_RATE) { elapsedTime = elapsedTime.Subtract(elapsedTime); target.doDamage(GameOptions.getZombieStrength()); } elapsedTime += time.ElapsedGameTime; if (elapsedTime.Milliseconds > 900) { elapsedTime.Add(oneSecond); } }
public void performAction(GameTime time, Unit mat) { //base.performAction(); if (elapsedTime.Seconds > WORK_RATE) { elapsedTime = elapsedTime.Subtract(elapsedTime); mat.repair(20); m_rotation = (float)Math.Atan2(m_position.X - mat.X, mat.Y - m_position.Y); move(new Vector2(mat.X, mat.Y)); } elapsedTime += time.ElapsedGameTime; if (elapsedTime.Milliseconds > 900) { elapsedTime.Add(oneSecond); } }