示例#1
0
    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();
    }
示例#2
0
    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();
    }
示例#4
0
    void GiveDamage(IReceiveDamage receiver)
    {
        Damage damage = new Damage();

        damage.health = healthDamage;
        damage.sender = sender;
        receiver.ReceiveDamage(damage);
    }
示例#5
0
 private void HandlePlayerCollision(Collider other)
 {
     entity = null;
     other.TryGetComponent <IReceiveDamage>(out entity);
     if (entity != null)
     {
         entity.ReceiveDamage(healAmount);
         this.gameObject.SetActive(false);
     }
 }
示例#6
0
    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);
    }
示例#7
0
    // 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;
    }
示例#8
0
    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);
    }