public void GetDurationOnBallTest2() { PoweredUpData data = new PoweredUpData(); data.MakeBallDeadly = false; data.ChangeBallDirection = false; data.ChangeBallSpeed = false; data.GivePlayerLife = false; data.ChangePaddleSpeed = false; data.UndoPlayerMove = false; Assert.AreEqual(0, data.GetDurationOnBall()); }
public void OnReceivedBallPowerUpMessage(byte ballId, byte powerUpId, PoweredUpData data) { if (ArenaObjects.TryGetValue(powerUpId, out ArenaObject pwp)) { var ball = ArenaBalls[ballId]; var poweredUpBall = ball.ApplyPowerup(data); DoAfterGameLoop.Add(() => { ArenaBalls[ball.GetId()] = poweredUpBall; }); // remove after a duration SafeInvoke.Instance.DelayedInvoke(data.GetDurationOnBall(), () => { RemoveBallPowerUp(poweredUpBall, data); }); (pwp as PowerUp).Use(); } }