public void TransferSentiment(PR_SentimentTarget doner, PR_SentimentTarget recipiant, int amount) { int num = Mathf.Min(doner.CurrentSentiment, Mathf.Min(amount, recipiant.MaxSentiment - recipiant.CurrentSentiment)); if (num > 0) { recipiant.CurrentSentiment += num; doner.CurrentSentiment -= num; } }
public override void OnHit(HitInfo hi, GameObject attacker) { if (hi.HasElement(ElementType.PSYCHIC) && attacker.GetComponent <PropertyHolder> () != null && attacker.GetComponent <PropertyHolder> ().HasProperty(this)) { PR_SentimentTarget a = attacker.GetComponent <PR_SentimentTarget>(); if (a.CurrentSentiment > 0) { ChangeSentiment(1); Instantiate(FXHit.Instance.FXSentiment, transform.position, Quaternion.identity); } } }