public void AddForceToSelectedDices(ref List <GameObject> dices, float force) { foreach (GameObject dice in dices) { Dice script = dice.GetComponent <Dice>(); if (script.IsSelected()) { if (isPlayer) { script.AddForce(-force); } else { script.AddForce(force); } } } }