/** * Deactivates a PowerUp * * @param powUp the PowerUp to deactivate */ public void Deactivate(PowerUp powUp) { PowDelegates dd = deactiveDelegates[(int)powUp.Type]; dd(powUp); effectivePow.Remove(powUp.Key); if (GameManager.state != GameManager.GameState.restart) { ShiftPowUps(powUp.Key); } }
/** * Activates a PowerUp * * @param powUp the PowerUp to activate */ public void Activate(PowerUp powUp) { int key = isEffective(powUp.Type); if (key >= 0) { effectivePow[key].ResetTimer(); powUp.Reload(); } else { PowDelegates ad = activeDelegates[(int)powUp.Type]; key = effectivePow.Count; powUp.Move((powPosition + key * (new Vector3(powWidth, 0, 0)))); ad(powUp); effectivePow.Add(key, powUp); powUp.Key = key; } }