public string Heal(string[] args) { var healerName = args[0]; var healingReceiverName = args[1]; var healer = this.party.FirstOrDefault(c => c.Name == healerName); if (healer == null) { throw new ArgumentException($"Character {healerName} not found!"); } var receiver = this.party.FirstOrDefault(c => c.Name == healingReceiverName); if (receiver == null) { throw new ArgumentException($"Character {healingReceiverName} not found!"); } IHealable healeable = null; try { healeable = (IHealable)healer; } catch (Exception) { throw new ArgumentException($"{healerName} cannot heal!"); } healeable.Heal(receiver); return($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}! {receiver.Name} has {receiver.Health} health now!"); }
void OnTriggerEnter(Collider col) { if (!col.gameObject.TryGetComponent(out PlayerStatus pstats)) { Physics.IgnoreCollision(myCollider, col); return; } IHealable applyHeal = col.gameObject.GetComponent <IHealable>(); if (applyHeal != null) { switch (buffType) { case 0: applyHeal.AddBuff(new DamageUpStatus(100000f)); break; case 1: applyHeal.AddBuff(new DefenseUpStatus(100000f)); break; case 2: applyHeal.AddBuff(new SpeedUpStatus(100000f)); break; } Destroy(gameObject); } }
public string Heal(string[] args) { string healerName = args[0]; string healingReceiverName = args[1]; Character healer = this.GetCharacter(healerName); Character healingReceiver = this.GetCharacter(healingReceiverName); if (!healer.GetType() .GetInterfaces() .Contains(typeof(IHealable))) { throw new ArgumentException($"{healerName} cannot heal!"); } IHealable healableCharacter = (IHealable)healer; healableCharacter.Heal(healingReceiver); string result = string.Format("{0} heals {1} for {2}! {3} has {4} health now!", healer.Name, healingReceiverName, healer.AbilityPoints, healingReceiverName, healingReceiver.Health); return(result); }
public void AddListener(IHealable _iHealable) { if (_iHealable != null) { iHealableInterfaces.Add(_iHealable); } }
public string Heal(string[] args) { string healerName = args[0]; string receiverName = args[1]; CheckIfCharacterExist(healerName); CheckIfCharacterExist(receiverName); Character healer = GetCharacter(healerName); Character receiver = GetCharacter(receiverName); if (!typeof(IHealable).IsAssignableFrom(healer.GetType())) { throw new ArgumentException($"{healer.Name} cannot heal!"); } IHealable tempHealer = (IHealable)healer; tempHealer.Heal(receiver); StringBuilder sb = new StringBuilder(); sb.AppendLine($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}! {receiver.Name} has {receiver.Health} health now!"); return(sb.ToString().TrimEnd('\n', '\r')); }
public string Heal(string[] args) { string healerName = args[0]; string healingReceiverName = args[1]; Character healer = this.party.FirstOrDefault(x => x.Name == healerName); if (healer == null) { throw new ArgumentException($"Character {healerName} not found!"); } Character receiver = this.party.FirstOrDefault(x => x.Name == healingReceiverName); if (receiver == null) { throw new ArgumentException($"Character {healingReceiverName} not found!"); } if (!(healer is IHealable) && receiver is IAttackable && healer.IsAlive && receiver.IsAlive) { throw new ArgumentException($"{healerName} cannot heal!"); } IHealable healer1 = healer; healer1.Heal(receiver); return($"{healer.Name} heals {receiver.Name} for {healer.AbilityPoints}! {receiver.Name} has {receiver.Health} health now!"); }
public int DoHeal(IHealable target, int healAmount) { var dmgHealed = target.TakeHeal(this, healAmount); OnDoneHeal(this, target, healAmount); return(dmgHealed); }
public override void Apply(MonoBehaviour client) { // Make sure the client can be healed bool intHealable = client as IHealable <int> != null; bool floatHealable = client as IHealable <float> != null; bool canHealClient = intHealable || floatHealable; if (canHealClient) { if (intHealable) { IHealable <int> toHeal = client as IHealable <int>; toHeal.TakeHealing(healAmount); } else if (floatHealable) { IHealable <float> toHeal = client as IHealable <float>; toHeal.TakeHealing(healAmount); } } else { // Report being unable to heal the client string format = "Healing effect {0} could not be applied on {1}; {1} does " + "not implement IHealable in a way that {0} supports."; string errMessage = string.Format(format, this.name, client.name); throw new System.ArgumentException(errMessage); } }
public static void HealEntity(IHealable obj, int val) { if (obj != null) { obj.OnHeal(val); } }
OnTriggerEnter(Collider other) { if (HealAmount > 0) { IHealable isHealable = other.GetComponent <IHealable>(); if (isHealable != null) { isHealable.Heal(HealAmount); timeLeft = respawnTimer; GetComponent <Renderer>().enabled = false; GetComponent <Collider>().enabled = false; _audioSource.Play(); } } else if (HealAmount < 0) { IDamageable isDamagable = other.GetComponent <IDamageable>(); if (isDamagable != null) { isDamagable.Damage(-HealAmount); timeLeft = respawnTimer; GetComponent <Renderer>().enabled = false; GetComponent <Collider>().enabled = false; _audioSource.Play(); } } }
public void HealTarget(IHealable h) { if (isActive) { h.Heal(healAmt); StartCoroutine(Cooldown()); } }
public override void Init(GameObject caster, GameObject target, Element element, StatusEffectData data) { base.Init(caster, target, element, data); healPerTick = data.DamagePerFrame; targetHealthSys = target.GetComponent <IHealable>(); }
protected override void React(Collider other) { IHealable target = other.GetComponent <IHealable>(); Assert.IsNotNull(target, $"{other.gameObject.name} doesn't implement IHealable interface"); healBehaviour.Heal(target); }
public override void UseItem(Transform user) { IHealable userHealable = user.GetComponent <IHealable>(); if (userHealable != null) { userHealable.Heal(healthRestoration); } }
public void OnTriggerStay(Collider other) { IHealable healable = other.GetComponent <IHealable>(); if (healable != null) { healable.Heal(_settings.HealingValue); } }
OnTriggerEnter(Collider other) { IHealable isHealable = other.GetComponent <IHealable> (); if (isHealable != null) { isHealable.Heal(100); } }
public void HealTarget(IHealable ih) { ih.HealHealth(healAmount); //Wouter BossSkillGeyser FMODUnity.RuntimeManager.PlayOneShotAttached("event:/Player/PlayerPickupHP", this.gameObject); Destroy(gameObject); }
private void RestoreHealth() { IHealable healable = _player.GetComponent <IHealable>(); if (healable != null) { healable.Heal(1.0f); } }
void IDoHeal.OnHeal(IHealer source, IHealable target, int amount) { var player = target as IPlayer; if (player.Seat == Ui.Seat) { StartCoroutine(Play()); } }
protected override void OnCollisionEnter(Collision Collision) { IHealable healable = Collision.gameObject.GetComponent <IHealable>(); if (healable != null && healable.CanHeal) { healable.Heal(new FHeal(_amount)); Destroy(gameObject); } }
public void Use(GameObject consumer) { IHealable target = consumer.GetComponent <IHealable>(); if (target != null) { target.Heal(HealthRestored); Logger.LogFormat("Used health potion to restore {0} health.", HealthRestored); } }
private void OnTriggerEnter2D(Collider2D collider) { IHealable healComponent = collider.GetComponent <IHealable>(); if (healComponent != null) { healComponent.Heal(healthRestore); Destroy(this.gameObject); } }
internal void TakeCare(IHealable healable) { if (healable.HealthStatus <= 80) { healable.Heal(40); } else if (healable.HealthStatus <= 100) { healable.Heal(30); } }
public float healing = 0; // Сила хила аптечки protected override void OnCollisionEnter2D(Collision2D collision) { IHealable healableObj = collision.gameObject.GetComponent <IHealable>(); if (healableObj != null) { healableObj.Heal(healing); base.OnCollisionEnter2D(collision); } }
void OnTriggerStay(Collider other) { if (other.tag == tag) { IHealable otherHealth = other.GetComponent <IHealable>(); if (otherHealth != null) { otherHealth.Heal(otherHealth.GetMaxHealth() * healthPerSecond * Time.deltaTime); } } }
public override void BeginEffect(Transform target) { IHealable healable = target.GetComponent <IHealable>(); if (healable != null) { healable.Heal(_value); } PlayParticles(target); }
void TryApplyHeal(IHealable target, int amount) { var targetChar = (IRuntimeCharacter)target; if (MyChar.Data.RuntimeData != targetChar) { return; } var notf = UiNotificationTextPooler.Instance.Get(); var final = transform.position + new Vector3(0, HeightNotification, 0); notf.Write(transform.position, final, amount + Heal, SpeedNotification, Color.green); }
void OnTriggerEnter2D(Collider2D col) { IHealable i = Lib.FindInHierarchy <IHealable>(col.gameObject); if (i == null) { return; } this.enabled = true; if (!inside.Contains(i)) { inside.Add(i); } }
void OnTriggerExit2D(Collider2D col) { IHealable i = Lib.FindInHierarchy <IHealable>(col.gameObject); if (i == null) { return; } inside.Remove(i); if (inside.Count <= 0) { this.enabled = false; } }
public DefendingCharacterState( IStateController controller, ISubject <AttackArgs> attackSubject, ISubject <DefendArgs> defendSubject, ISubject <HealArgs> healSubject, IDamageable damageable, IHealable healable ) : base(controller, attackSubject, defendSubject, healSubject, damageable, healable) { }