public void Consume(object obj) { IReceiveDamage receiver = obj as IReceiveDamage; if (receiver == null) { return; } Damage damage = new Damage(-Health); receiver.ReceiveDamage(damage); if (Session.NetActive()) { Actor actor = obj as Actor; if (actor != null) { actor.Rpc(nameof(Actor.RemoteReceiveDamage), JsonConvert.SerializeObject(damage, Formatting.Indented)); } } this.QueueFree(); }
void GiveDamage(IReceiveDamage receiver) { Damage damage = new Damage(); damage.health = HealthDamage; receiver.ReceiveDamage(damage); }
public void Consume(object obj) { IReceiveDamage receiver = obj as IReceiveDamage; if (receiver == null) { return; } Damage damage = new Damage(-Health); receiver.ReceiveDamage(damage); if (Session.NetActive()) { Actor actor = obj as Actor; if (actor != null) { actor.Rpc(nameof(Actor.RemoteReceiveDamage), ""); } } this.QueueFree(); }
void GiveDamage(IReceiveDamage receiver) { Damage damage = new Damage(); damage.health = healthDamage; damage.sender = sender; receiver.ReceiveDamage(damage); }
private void HandlePlayerCollision(Collider other) { entity = null; other.TryGetComponent <IReceiveDamage>(out entity); if (entity != null) { entity.ReceiveDamage(healAmount); this.gameObject.SetActive(false); } }
public virtual void GiveDamage(IReceiveDamage receiver) { Damage damage = new Damage(healthDamage); Node wielderNode = wielder as Node; if (wielderNode != null) { damage.sender = wielderNode.GetPath(); } receiver.ReceiveDamage(damage); }
// Should only occur once. void GiveDamage(IReceiveDamage receiver) { if (stopColliding) { return; } Damage damage = new Damage(); damage.health = healthDamage; damage.sender = sender; receiver.ReceiveDamage(damage); stopColliding = true; }
public override void ApplyPowerUp(object obj) { IReceiveDamage receiver = obj as IReceiveDamage; if (receiver == null) { return; } Damage damage = new Damage(-Health); receiver.ReceiveDamage(damage); this.QueueFree(); }
public override void GiveDamage(IReceiveDamage receiver) { Damage damage = new Damage(healthDamage); Node wielderNode = wielder as Node; Node pastWielderNode = pastWielder as Node; if (wielderNode != null) { damage.sender = wielderNode.GetPath(); } else if (pastWielderNode != null) { damage.sender = pastWielderNode.GetPath(); } GD.Print("Sender : " + damage.sender); receiver.ReceiveDamage(damage); }