Exemple #1
0
    public void SV_Die()
    {
        if (!entity.isOwner)
        {
            return;
        }

        var deathEvent = DeathEvent.Create(entity);

        deathEvent.Send();

        BoltNetwork.Destroy(gameObject);
    }
Exemple #2
0
    public override void Die(string killer, int weaponID)
    {
        //TODO check comments on Death
        //Do we need to reset the available weapon list here like this? Probably not...
        //Actually, do we need to reset the references on any of these components?
        //I thought death was a simple death animation combined with being moved around to your new spawn location.
        AvailableWeapons = new List <IWeapon>();
        Debug.Log("Player " + Username + " was killed by " + killer + " using weapon #" + weaponID);
        //we need to tell the server that we died so that it can respawn us
        DeathEvent evnt = DeathEvent.Create(Bolt.GlobalTargets.OnlyServer, Bolt.ReliabilityModes.ReliableOrdered);

        evnt.Killer   = killer;
        evnt.Player   = Username;
        evnt.WeaponID = weaponID;
        evnt.Send();
        this.Health = MaxHealth;
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (!entity.IsOwner())
        {
            return;
        }

        var deathEvent = DeathEvent.Create(entity);

        deathEvent.Send();

        BoltNetwork.Destroy(gameObject);

        Hitbox otherHitbox = collision.collider.GetComponent <Hitbox>();

        if (otherHitbox)
        {
            otherHitbox.Damage(damage);
        }
    }