Ejemplo n.º 1
0
    private void CmdDamage(NetworkInstanceId hit, float distance)
    {
        NetworkEntity ne = ClientScene.FindLocalObject(hit).GetComponent <NetworkEntity>();

        //float distance = Vector2.Distance(owner.attacking_offset.position, ne.transform.position);
        if (fall_off_type == FalloffType.Hard)
        {
            ne.ChangeHealth(owner, -damage * (1 - distance / max_distance));
        }
        else if (fall_off_type == FalloffType.Medium)
        {
            ne.ChangeHealth(owner, -damage * (1 - distance / max_distance) * 0.5f - damage * 0.5f);
        }
        else if (fall_off_type == FalloffType.None)
        {
            ne.ChangeHealth(owner, -damage);
        }
    }