Пример #1
0
    void SendShoot()
    {
        shootRay.origin    = gunBarrelEnd.transform.position;
        shootRay.direction = transform.forward;

        if (Physics.Raycast(shootRay, out shootHit, range, shootableMask))
        {
            ClientEntity enemyEntity = shootHit.collider.GetComponent <ClientEntity> ();
            if (enemyEntity != null)
            {
                self.CallServer("ShootHit", enemyEntity.ID);
            }
            else
            {
                self.CallServer("ShootMiss");
            }
        }
        else
        {
            self.CallServer("ShootMiss");
        }
    }