private void UpdateCounter(CounterBehaviour counter, PlayField playField, string label, string propName) { if (counter != null) { counter.Label = label; if (playField != null) { var prop = typeof(PlayField).GetProperty(propName); counter.Count = (int)prop.GetValue(playField); } } }
/// <summary> /// 確定したこうげきだまを送る /// </summary> /// <param name="field"></param> public void SendAttackTama(PlayField field) { PlayField opponent = null; if (field == playFields[0]) { opponent = playFields[1]; } else { opponent = playFields[0]; } opponent.RecievedAttackCount += field.SendAttackCount; field.SendAttackCount = 0; }
/// <summary> /// 各プレイヤーのこうげきだま数更新 /// </summary> /// <param name="p0">自分</param> /// <param name="p1">相手</param> /// <param name="n">自分の表示</param> private void UpdateAttackCount(PlayField p0, PlayField p1, NumberDisplay n) { if (n == null || p0 == null) { return; } int count = p0.SendAttackCount; if (p1 != null) { count += p1.RecievedAttackCount; } if (n.Number < count) { ++n.Number; } else if (n.Number > count) { --n.Number; } }