Ejemplo n.º 1
0
    void GiveDamage(IReceiveDamage receiver)
    {
        Damage damage = new Damage();

        damage.health = HealthDamage;
        receiver.ReceiveDamage(damage);
    }
Ejemplo n.º 2
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();
    }
Ejemplo n.º 3
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), "");
            }
        }

        this.QueueFree();
    }
Ejemplo n.º 4
0
    public override void DoOnCollide(object body)
    {
        HandlePickup(body);

        if (!swinging)
        {
            return;
        }
        if (thrown)
        {
            swinging = false;
            this.SetAxisVelocity(new Vector3());
        }

        IReceiveDamage receiver      = body as IReceiveDamage;
        IReceiveDamage wielderDamage = wielder as IReceiveDamage;

        if (wielderDamage == null)
        {
            wielderDamage = pastWielder as IReceiveDamage;
        }

        if (receiver != null && receiver != wielderDamage)
        {
            Strike(receiver);
        }
        else if (receiver == wielderDamage)
        {
            swinging = true;
        }
    }
Ejemplo n.º 5
0
    void GiveDamage(IReceiveDamage receiver)
    {
        Damage damage = new Damage();

        damage.health = healthDamage;
        damage.sender = sender;
        receiver.ReceiveDamage(damage);
    }
Ejemplo n.º 6
0
 private void HandlePlayerCollision(Collider other)
 {
     entity = null;
     other.TryGetComponent <IReceiveDamage>(out entity);
     if (entity != null)
     {
         entity.ReceiveDamage(healAmount);
         this.gameObject.SetActive(false);
     }
 }
Ejemplo n.º 7
0
    public override void DoOnCollide(object body)
    {
        IReceiveDamage receiver = body as IReceiveDamage;

        if (receiver != null)
        {
            ;
            GiveDamage(receiver);
        }
        this.QueueFree();
    }
Ejemplo n.º 8
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);
    }
Ejemplo n.º 9
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;
    }
Ejemplo n.º 10
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();
    }
Ejemplo n.º 11
0
    public override void DoOnCollide(object body)
    {
        if (!swinging)
        {
            return;
        }
        IReceiveDamage receiver      = body as IReceiveDamage;
        IReceiveDamage wielderDamage = wielder as IReceiveDamage;

        if (receiver != null && receiver != wielderDamage)
        {
            Strike(receiver);
        }
    }
Ejemplo n.º 12
0
    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);
    }
Ejemplo n.º 13
0
 private void Strike(IReceiveDamage receiver)
 {
     GiveDamage(receiver);
     EndSwing();
 }
Ejemplo n.º 14
0
 public void Strike(IReceiveDamage receiver)
 {
     GiveDamage(receiver);
     swinging = false;
 }