public override void TakeEffect(AbilityInfo[] info) { base.TakeEffect(info); int value = GetValue(); StatsChangeStatus status = Instantiate(m_Status); InitStatus(status, value); TargetInfo targetInfo = GetAbilityInfo <TargetInfo>(); foreach (Unit unit in targetInfo.m_Targets) { Apply(unit, status); } }
private void InitStatus(StatsChangeStatus status, int value) { status.m_Property = m_property; int deltaValue = 0; switch (m_type) { case DefaultType.basic: deltaValue = value + m_Value; break; case DefaultType.maximum: deltaValue = value >= m_Value ? m_Value : value; break; case DefaultType.minimum: deltaValue = value <= m_Value ? m_Value : value; break; } status.m_ChangedValue = deltaValue; }
private void Apply(Unit unit, StatsChangeStatus status) { //Debug.Log("["+this + "] apply [" + m_Status + "] to [" + unit+"]"); unit.m_Status.ApplyStatus(Instantiate(status)); }