Exemplo n.º 1
0
        public void OnCollisionAction(ProjectileData projectile, Collision collision)
        {
            var damage = 2 * DamageFactor;

            _ownerCharacterData.HitPoints -= (int)damage;

            MessageBus.SendMessage(NetBroadcastMessage.Get(Network.API.Messages.DELETE_OBJECT, UnityEngine.Networking.QosType.Reliable,
                                                           projectile.GetComponent <Channel>().ChannelIds[SubscribeType.Network]));

            Destroy(projectile.gameObject);
        }
Exemplo n.º 2
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log(other.gameObject.layer);
        if (other.gameObject.layer == LayerMask.NameToLayer("CoverZone"))
        {
            coverAvailable = true;
            coverLevel    += 1;
        }

        if (other.gameObject.CompareTag("Bullet"))
        {
            Debug.Log("ouch");
            ProjectileData proj = other.gameObject.GetComponent <ProjectileData>();
            modHealth(proj.GetComponent <ProjectileData>().Damage);
        }
    }